plot.lm(stats)
plot.lm()所属R语言包:stats
Plot Diagnostics for an lm Object
图诊断为LM对象
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Six plots (selectable by which) are currently available: a plot of residuals against fitted values, a Scale-Location plot of sqrt(| residuals |) against fitted values, a Normal Q-Q plot, a plot of Cook's distances versus row labels, a plot of residuals against leverages, and a plot of Cook's distances against leverage/(1-leverage). By default, the first three and 5 are provided.
6图(可选which)是目前可供选择:对拟合值的残差,规模,地点图图sqrt(| residuals |)对拟合值,一个正常的QQ图,库克与行的距离图标签,反对利用残差图,打击利用图和库克的距离/(1-杠杆)。默认情况下,前三5提供。
用法----------Usage----------
## S3 method for class 'lm'
plot(x, which = c(1:3,5),
caption = list("Residuals vs Fitted", "Normal Q-Q",
"Scale-Location", "Cook's distance",
"Residuals vs Leverage",
expression("Cook's dist vs Leverage " * h[ii] / (1 - h[ii]))),
panel = if(add.smooth) panel.smooth else points,
sub.caption = NULL, main = "",
ask = prod(par("mfcol")) < length(which) && dev.interactive(),
...,
id.n = 3, labels.id = names(residuals(x)), cex.id = 0.75,
qqline = TRUE, cook.levels = c(0.5, 1.0),
add.smooth = getOption("add.smooth"), label.pos = c(4,2),
cex.caption = 1)
参数----------Arguments----------
参数:x
lm object, typically result of lm or glm.
lm对象,通常导致lm或glm。
参数:which
if a subset of the plots is required, specify a subset of the numbers 1:6.
图的一个子集,如果需要,指定数字1:6的一个子集。
参数:caption
captions to appear above the plots; character vector or list of valid graphics annotations, see as.graphicsAnnot. Can be set to "" or NA to suppress all captions.
标题出现上述图;character矢量或list有效的图形注解,看到as.graphicsAnnot的。可以设置""或NA抑制所有的标题。
参数:panel
panel function. The useful alternative to points, panel.smooth can be chosen by add.smooth = TRUE.
面板功能。有用替代points“,panel.smooth可以选择add.smooth = TRUE。
参数:sub.caption
common title—above the figures if there are more than one; used as sub (s.title) otherwise. If NULL, as by default, a possible abbreviated version of deparse(x$call) is used.
上述数字常见的标题,如果有一个以上的;sub(S.title),否则使用。如果NULL,默认情况下,可能deparse(x$call)缩写版本使用。
参数:main
title to each plot—in addition to caption.
标题每剧情中除了caption。
参数:ask
logical; if TRUE, the user is asked before each plot, see par(ask=.).
逻辑;如果TRUE,用户要求每个小区前,看到par(ask=.)。
参数:...
other parameters to be passed through to plotting functions.
其他参数可以通过绘图功能。
参数:id.n
number of points to be labelled in each plot, starting with the most extreme.
必须标明在每个小区中,最极端的开始点。
参数:labels.id
vector of labels, from which the labels for extreme points will be chosen. NULL uses observation numbers.
标签的向量,从中将选择极端点的标签。 NULL使用观察数字。
参数:cex.id
magnification of point labels.
放大点标签。
参数:qqline
logical indicating if a qqline() should be added to the normal Q-Q plot.
逻辑表示如果qqline()应加入正常的QQ图。
参数:cook.levels
levels of Cook's distance at which to draw contours.
库克在其中绘制等高线的距离的水平。
参数:add.smooth
logical indicating if a smoother should be added to most plots; see also panel above.
逻辑表明,如果平滑应增加最图;又见panel以上。
参数:label.pos
positioning of labels, for the left half and right half of the graph respectively, for plots 1-3.
定位标签的左半部和右半图分别为图1-3。
参数:cex.caption
controls the size of caption.
控制caption的大小。
Details
详情----------Details----------
sub.caption—by default the function call—is shown as a subtitle (under the x-axis title) on each plot when plots are on separate pages, or as a subtitle in the outer margin (if any) when there are multiple plots per page.
sub.caption默认情况下,函数调用显示字幕(x轴的标题下对每个小区)图单独的页面上时,或在外缘的副标题(如果有的话),当有每页的多个图。
The "Scale-Location" plot, also called "Spread-Location" or "S-L" plot, takes the square root of the absolute residuals in order to diminish skewness (sqrt(|E|)) is much less skewed than | E | for Gaussian zero-mean E).
以减少偏的规模,地点“的图,也被称为”扩展位置“或”S-L“图,以绝对残差平方根(sqrt(|E|))要少得多倾斜比| E |零均值高斯E)。
The "S-L", the Q-Q, and the Residual-Leverage plot, use standardized residuals which have identical variance (under the hypothesis). They are given as R[i] / (s * sqrt(1 - h.ii)) where h.ii are the diagonal entries of the hat matrix, influence()$hat (see also hat), and where the Residual-Leverage plot uses standardized Pearson residuals (residuals.glm(type = "pearson")) for R[i].
“S-L”,QQ,并利用剩余图,使用标准化残差具有相同的方差(根据假设)。他们给出R[i] / (s * sqrt(1 - h.ii))其中,h.ii的帽子矩阵对角线项,influence()$hat(又见hat),并在剩余杠杆图使用标准化皮尔森残差(:residuals.glm(type = "pearson"))R[i]。
The Residual-Leverage plot shows contours of equal Cook's distance, for values of cook.levels (by default 0.5 and 1) and omits cases with leverage one with a warning. If the leverages are constant (as is typically the case in a balanced aov situation) the plot uses factor level combinations instead of the leverages for the x-axis. (The factor levels are ordered by mean fitted value.)
剩余杠杆图的平等库克的距离显示的轮廓,为值cook.levels(默认情况下,0.5和1),忽略警告杠杆情况。如果利用常数(通常是在一个平衡的aov形势的情况下)的图使用因子水平的组合,而不是利用为x轴。 (因子水平排序,平均拟合值)。
In the Cook's distance vs leverage/(1-leverage) plot, contours of standardized residuals that are equal in magnitude are lines through the origin. The contour lines are labelled with the magnitudes.
在库克的距离与利用/(1-杠杆)的图,大小相等的标准化残差的轮廓是通过原点的线。等高线标记的大小。
作者(S)----------Author(s)----------
John Maindonald and Martin Maechler.
参考文献----------References----------
Regression Diagnostics. New York: Wiley.
Residuals and Influence in Regression. London: Chapman and Hall.
Reid, N. and Snell, E. J., eds: Pp. 55-82 in Statistical Theory and Modelling. In Honour of Sir David Cox, FRS. London: Chapman and Hall.
symmetry. Biometrika 62, 101–111.
Generalized Linear Models. London: Chapman and Hall.
参见----------See Also----------
termplot, lm.influence, cooks.distance, hatvalues.
termplot,lm.influence,cooks.distance,hatvalues。
举例----------Examples----------
require(graphics)
## Analysis of the life-cycle savings data[#生命周期储蓄数据的分析]
## given in Belsley, Kuh and Welsch.[#给予Belsley山和韦尔施。]
lm.SR <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
plot(lm.SR)
## 4 plots on 1 page;[第1页#4图;]
## allow room for printing model formula in outer margin:[#允许房间印刷外缘的模型公式:]
par(mfrow = c(2, 2), oma = c(0, 0, 2, 0))
plot(lm.SR)
plot(lm.SR, id.n = NULL) # no id's[没有id]
plot(lm.SR, id.n = 5, labels.id = NULL)# 5 id numbers[5身份证号码]
## Was default in R <= 2.1.x:[#默认情况下,在R <= 2.1.x的:]
## Cook's distances instead of Residual-Leverage plot[#库克的距离,而不是剩余杠杆图]
plot(lm.SR, which = 1:4)
## Fit a smooth curve, where applicable:[#适合一条光滑的曲线,如适用:]
plot(lm.SR, panel = panel.smooth)
## Gives a smoother curve[#给人一种流畅的曲线]
plot(lm.SR, panel = function(x,y) panel.smooth(x, y, span = 1))
par(mfrow=c(2,1))# same oma as above[同OMA如上]
plot(lm.SR, which = 1:2, sub.caption = "Saving Rates, n=50, p=5")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|