How does plot.lm () determine which points are outliers (that is, that points to a label) for a residual or set chart? The only thing I found in the documentation :
More details
sub.caption - by default, a function call is displayed as a subtitle (under the x-axis heading) on each graph when the graphs are on separate pages or as subtitles in an external field (if any) when there are several graphs on the page.
The Scale-to-Location graph, also called “Spread-to-Location” or “SL,” takes the square root of absolute residuals to reduce asymmetry (sqrt (| E |)), much less distortion than | E | for a Gaussian zero mean E).
The string "SL", QQ, and residual-arm uses standardized residuals that have the same variance (hypothesized). They are defined as R [i] / (s * sqrt (1 - h.ii)), where h.ii are diagonal elements of the hat matrix, influence () $ hat (see also hat) and where Residual- On the shoulder graph are used standardized Pearson residues (.glm residues (type = "pearson")) for R [i].
The Residual Lever graph shows the contours of an equal amount of Cook, for cook.levels (defaults to 0.5 and 1) and omits the cases with a warning lever. If leverage is constant (as is usually the case with aov in a balanced situation), combinations of factors are used on the chart, not leverage for the x axis. (Levels of factors are ordered by the average set value.)
On the “Cook” and “shoulder” / (1-shoulder) graphs, the contours of standardized residues, which are equal in magnitude in magnitude, are lines through the origin. Contour lines are indicated by values.
But it does not say anything about how the balances were created against the established schedule and how he chooses which points to label.
Update : Zheyuan Li's answer suggests that the way the residual versus the set chart outlines the points is really simple by looking at the 3 points with the largest residuals. It really is. This can be demonstrated by the following “extreme” example.
x = c(1,2,3,4,5,6) y = c(2,4,6,8,10,12) foo = data.frame(x,y) model = lm(y ~ x, data = foo)
