weights.sparseLTS(robustHD)
weights.sparseLTS()所属R语言包:robustHD
Extract outlier weights from sparse LTS regression models
解压缩稀疏的离群点权重的LTS的回归模型
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Extract binary weights that indicate outliers from sparse least trimmed squares regression models.
提取二进制的权重,表明至少修剪稀疏最小二乘回归模型的异常值。
用法----------Usage----------
## S3 method for class 'sparseLTS'
weights(object,
fit = c("reweighted", "raw", "both"), ...)
## S3 method for class 'sparseLTSGrid'
weights(object, s,
fit = c("reweighted", "raw", "both"), ...)
参数----------Arguments----------
参数:object
the model fit from which to extract outlier weights.
模型拟合,从中提取离群值的权重。
参数:s
an integer vector giving the indices of the models for which to extract outlier weights. If fit is "both", this can be a list with two components, with the first component giving the indices of the reweighted fits and the second the indices of the raw fits. The default is to use the optimal model for each of the requested estimators. Note that the optimal models may not correspond to the same value of the penalty parameter for the reweighted and the raw estimator.
整数向量,指数的模型中提取离群值的权重。 fit如果是"both",这可以是一个表两部分组成,第一部分给指数的重新加权拟合和第二个指标的原始适合。在默认情况下是使用最优化模型,为每个请求的估计。请注意,优化模型可能不符合相同的刑罚为重加权参数和原始估计值。
参数:fit
a character string specifying for which estimator to extract outlier weights. Possible values are "reweighted" (the default) for weights indicating outliers from the reweighted fit, "raw" for weights indicating outliers from the raw fit, or "both" for the outlier weights from both estimators.
一个字符串,指定提取的估计离群值的权重。可能的值是"reweighted"(默认值)的权重,表明异常值的重新加权拟合,"raw"的权重,表示异常值从原始的配合,或"both"两个估计量为离群值的权重。
参数:...
currently ignored.
目前被忽略。
值----------Value----------
If weights indicating outliers are requested for only one model, they are returned in the form of a numeric vector.
如果权重,表示异常值的要求只有一个模式,他们将返回一个数值向量的形式。
Otherwise a numeric matrix is returned in which each column contains weights indicating outliers from the corresponding model.
否则,返回的数字矩阵的每一列都包含相应的模型表明离群的权重。
注意----------Note----------
The weights are 1 for observations with reasonably small residuals and 0 for observations with large residuals.
权重是1相当小的残差和0观测残差与大的观测。
(作者)----------Author(s)----------
Andreas Alfons
参见----------See Also----------
weights, sparseLTS, sparseLTSGrid
weights,sparseLTS,sparseLTSGrid
实例----------Examples----------
## generate data[#生成数据]
# example is not high-dimensional to keep computation time low[例如不高维的计算时间保持低]
library("mvtnorm")
set.seed(1234) # for reproducibility[可重复性]
n <- 100 # number of observations[的观测数]
p <- 25 # number of variables[的变量数目]
beta <- rep.int(c(1, 0), c(5, p-5)) # coefficients[系数]
sigma <- 0.5 # controls signal-to-noise ratio[控制的信号 - 噪声比]
epsilon <- 0.1 # contamination level[污染水平]
Sigma <- 0.5^t(sapply(1:p, function(i, j) abs(i-j), 1:p))
x <- rmvnorm(n, sigma=Sigma) # predictor matrix[预测矩阵]
e <- rnorm(n) # error terms[误差项]
i <- 1:ceiling(epsilon*n) # observations to be contaminated[受到污染的意见]
e[i] <- e[i] + 5 # vertical outliers[垂直离群]
y <- c(x %*% beta + sigma * e) # response[响应]
x[i,] <- x[i,] + 5 # bad leverage points[坏的平衡点]
## sparse LTS[#稀疏LTS]
# fit model[拟合模型]
fit <- sparseLTS(x, y, lambda = 0.05, mode = "fraction")
# extract outlier weights[提取离群值的权重]
weights(fit)
weights(fit, fit = "both")
## sparse LTS over a grid of values for lambda[#稀疏LTS为lambda值一格的]
# fit model[拟合模型]
frac <- seq(0.25, 0.05, by = -0.05)
fitGrid <- sparseLTSGrid(x, y, lambda = frac, mode = "fraction")
# extract outlier weights[提取离群值的权重]
weights(fitGrid)
weights(fitGrid, fit = "both")
weights(fitGrid, s = NULL)
weights(fitGrid, fit = "both", s = NULL)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|