diagnosticPlot(robustHD)
diagnosticPlot()所属R语言包:robustHD
Diagnostic plots for sparse LTS regression models
稀疏LTS回归模型的诊断图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Produce diagnostic plots for sparse least trimmed squares regression models. Four plots are currently implemented.
产生稀疏至少修剪最小二乘回归模型的诊断图。目前正在实施四个图。
用法----------Usage----------
diagnosticPlot(x, ...)
## S3 method for class 'sparseLTS'
diagnosticPlot(x,
fit = c("reweighted", "raw", "both"),
which = c("all", "rqq", "rindex", "rfit", "rdiag"),
ask = (which == "all"), id.n = NULL, ...)
## S3 method for class 'sparseLTSGrid'
diagnosticPlot(x, ...)
## S3 method for class 'sparseLTS'
plot(x, ...)
参数----------Arguments----------
参数:x
the model fit for which to produce diagnostic plots.
模型拟合的诊断图。
参数:fit
a character string specifying for which fit to produce diagnostic plots. Possible values are "reweighted" (the default) for diagnostic plots for the reweighted fit, "raw" for diagnostic plots for the raw fit, or "both" for diagnostic plots for both fits.
一个字符串指定的适合产生诊断图。可能的值是"reweighted"(默认值)为诊断为重加权拟合图,"raw"诊断图为原料的配合,或"both"诊断图都适合的。
参数:which
a character string indicating which plot to show. Possible values are "all" (the default) for all of the following, "rqq" for a normal Q-Q plot of the standardized residuals, "rindex" for a plot of the standardized residuals versus their index, "rfit" for a plot of the standardized residuals versus the fitted values, or "rdiag" for a regression diagnostic plot (standardized residuals versus robust Mahalanobis distances of the predictor variables).
一个字符串表示的曲线图显示。可能的值是"all"(默认值)以下,"rqq"一个正常的标准化残差的QQ图,"rindex"指数的标准化残差与他们的图, "rfit"的标准化残差与拟合值,或"rdiag"的回归诊断图(标准化残差与强大的马氏距离的预测变量)的图。
参数:ask
a logical indicating whether the user should be asked before each plot (see devAskNewPage). The default is to ask if all plots are requested and not ask otherwise.
逻辑指示用户是否应被问过的每个图(见devAskNewPage“)。默认情况下是要问,如果所有的图被要求,而不是要求,否则。
参数:id.n
an integer giving the number of the most extreme observations to be identified by a label. The default is to use the number of identified outliers, which can be different for the different plots. See “Details” for more information.
一个整数,给出的数目要由标签标识的最极端的观测。默认情况下使用的数量确定的离群值,可以是不同的不同图。有关更多信息,请参阅“详细信息”。
参数:...
for the generic function diagnosticPlot, additional arguments to be passed down to methods. For the "sparseLTSGrid" method of diagnosticPlot, additional arguments to be passed down to the "sparseLTS" method. For the "sparseLTS" method of diagnosticPlot, additional arguments to be passed down to xyplot. For the "sparseLTS" method of plot, additional arguments to be passed down to diagnosticPlot.
的通用函数diagnosticPlot,额外的参数传递的方法。对于"sparseLTSGrid"方法diagnosticPlot,其他参数传递给"sparseLTS"方法。对于"sparseLTS"方法diagnosticPlot,其他参数传递给xyplot。对于"sparseLTS"方法plot,其他参数传递给diagnosticPlot。
Details
详细信息----------Details----------
In the normal Q-Q plot of the standardized residuals, a reference line is drawn through the first and third quartile. The id.n observations with the largest distances from that line are identified by a label (the observation number). The default for id.n is the number of regression outliers, i.e., the number of observations with outlier weight equal to 0 (see weights).
在正常的QQ图的标准化残差,基准线被绘制通过第一和第三四分位。 id.n观察与从该行中的最大的距离,确定由一个标签(观察号码)。默认为id.n是回归离群值,即若干意见与离群重量等于0(见weights“)。
In the plots of the standardized residuals versus their index or the fitted values, horizontal reference lines are drawn at 0 and +/-2.5. The id.n observations with the largest absolute values of the standardized residuals are identified by a label (the observation number). The default for id.n is the number of regression outliers, i.e., the number of observations with outlier weight equal to 0 (see weights).
在他们的指数的拟合值与标准化残差图,绘制水平参考线在0和+ / -2.5。 id.n观测的标准化残差与最大的绝对值确定的一个标签(观察数)。默认为id.n是回归离群值,即若干意见与离群重量等于0(见weights“)。
For the regression diagnostic plot, the robust Mahalanobis distances of the predictor variables are computed via the MCD based on only those predictors with non-zero coefficients. Horizontal reference lines are drawn at +/-2.5 and a vertical reference line is drawn at the upper 97.5% quantile of the chi-squared distribution with p degrees of freedom, where p denotes the number of predictors with non-zero coefficients. The id.n observations with the largest absolute values of the standardized residuals and/or largest robust Mahalanobis distances are identified by a label (the observation number). The default for id.n is the number of all outliers: regression outliers (i.e., observations with outlier weight equal to 0, see weights) and leverage points (i.e., observations with robust Mahalanobis distance larger than the 97.5% quantile of the chi-squared distribution with p degrees of freedom).
对于的回归诊断图,强大的马氏距离计算的预测变量通过MCD只有那些具有非零系数的预测的基础上。水平参考线绘制在+ / -2.5和一条垂直参考线被画在上部chi-squaredp自由度分布,其中p表示的数量的97.5%的分位数具有非零系数的预测。 id.n观测与标准化的残差和/或最大的健壮的马氏距离的绝对值最大的值确定的一个标签(观察号码)。的默认值id.n是异常值:回归离群值(即,观察离群值的重量等于0,weights),并利用点(即,观察与强大的马氏距离大于97.5 %位数的chi-squared分布p自由度)。
值----------Value----------
If only one plot is requested, an object of class "trellis" (see xyplot), otherwise a list of such objects.
类的一个对象被请求时,如果只有一个图"trellis"(见xyplot),否则这样的对象的列表。
(作者)----------Author(s)----------
Andreas Alfons, partly based on code by Valentin Todorov
参见----------See Also----------
plot, plot.lts, sparseLTS, sparseLTSGrid
plot,plot.lts,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")
# create plot[创建图]
plot(fit)
plot(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")
# create plot[创建图]
diagnosticPlot(fitGrid)
diagnosticPlot(fitGrid, fit = "both")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|