为了可重复性,我已使用 set.seed(2016) 编辑了您的问题。为了回答你的问题,我需要解释一下如何产生你看到的QQ图。
se <- sqrt(sum(mara$residuals^2) / mara$df.residual) ## Pearson residual standard error
hii <- lm.influence(mara, do.coef = FALSE)$hat ## leverage
std.resi <- mara$residuals / (se * sqrt(1 - hii)) ## standardized residuals
## these three lines can be replaced by: std.resi <- rstandard(mara)
现在,让我们比较一下我们自己生成的QQ图和plot.lm生成的图:
par(mfrow = c(1,2))
qqnorm(std.resi, main = "my Q-Q"); qqline(std.resi, lty = 2)
plot(mara, which = 2) ## only display Q-Q plot
一样,对吧?
现在,剩下的唯一问题是如何标记数字。那些标记的点标记了最大的 3 个绝对标准化残差。考虑:
x <- sort(abs(std.resi), decreasing = TRUE)
id <- as.integer(names(x))
id[1:3]
# [1] 23 8 12
现在,如果您仔细查看图表,您会发现这三个数字正是显示的内容。知道了这个,你也可以去看看,比如id[1:5]。