Algorithm Search⌘K

Definitioncore

Studentized residual

Also called externally studentized residual, deleted residual.

A residual divided by an estimate of its standard deviation that accounts for its leverage. With the point left out of the variance estimate it has a t distribution.

A studentized residual is a regression residual divided by an estimate of its own standard deviation. Raw residuals do not have equal variances even when the errors do: Var⁡(ei)=σ2(1−hii)\operatorname{Var}(e_i) = \sigma^2(1 - h_{ii}), where hiih_{ii} is the leverage, so residuals at high-leverage points are small by construction. Dividing by s1−hiis\sqrt{1 - h_{ii}} puts all residuals on one scale. The internal version uses the usual ss; the external version uses s(i)s_{(i)}, computed without observation ii, and under normal errors it has the t distribution with n−p−1n - p - 1 degrees of freedom exactly. Both come from one fit, without refitting.

Definition

Let y=Xb+εy = Xb + \varepsilon with XX an n×pn \times p matrix of rank pp (intercept included in the pp columns), bb the coefficient vector and ε\varepsilon with uncorrelated entries of mean 0 and variance σ2\sigma^2. Let b^\hat b be the least squares estimate, e=y−Xb^e = y - X\hat b the residuals, hiih_{ii} the diagonal of the hat matrix, and s2=∑ej2/(n−p)s^2 = \sum e_j^2/(n - p). Assume hii<1h_{ii} < 1.

Internally studentized residual (also called the standardized residual):

ri=eis1−hii.r_i = \frac{e_i}{s\sqrt{1 - h_{ii}}}.

Deleted variance. Let s(i)2s_{(i)}^2 be the residual variance estimate of the fit without observation ii, with n−p−1n - p - 1 degrees of freedom. One fit gives it:

s(i)2=(n−p)s2−ei2/(1−hii)n−p−1.s_{(i)}^2 = \frac{(n - p)s^2 - e_i^2/(1 - h_{ii})}{n - p - 1}.

Externally studentized residual (also called the deleted studentized residual, or RSTUDENT):

ti=eis(i)1−hii=rin−p−1n−p−ri2.t_i = \frac{e_i}{s_{(i)}\sqrt{1 - h_{ii}}} = r_i\sqrt{\frac{n - p - 1}{n - p - r_i^2}}.

The deleted residual and why tit_i is a t statistic. Let y^(i)=xi⊤b^(i)\hat y_{(i)} = x_i^\top\hat b_{(i)} be the prediction of yiy_i from the fit without ii. By the Sherman-Morrison formula, the deleted (or PRESS) residual is di=yi−y^(i)=ei/(1−hii)d_i = y_i - \hat y_{(i)} = e_i/(1 - h_{ii}), and Var⁡(di)=σ2(1+xi⊤(X(i)⊤X(i))−1xi)=σ2/(1−hii)\operatorname{Var}(d_i) = \sigma^2\big(1 + x_i^\top(X_{(i)}^\top X_{(i)})^{-1}x_i\big) = \sigma^2/(1 - h_{ii}). So ti=di/(s(i)/1−hii)t_i = d_i/(s_{(i)}/\sqrt{1 - h_{ii}}) is the prediction error of a point not used in the fit, divided by its estimated standard error. Under iid N(0,σ2)N(0, \sigma^2) errors, yiy_i is independent of the other n−1n - 1 observations, and from those, b^(i)\hat b_{(i)} and s(i)2s_{(i)}^2 are independent with (n−p−1)s(i)2/σ2∼χn−p−12(n - p - 1)s_{(i)}^2/\sigma^2 \sim \chi^2_{n-p-1}. So did_i is normal with mean 0, independent of s(i)s_{(i)}, and

ti∼tn−p−1exactly, for each fixed i.t_i \sim t_{n-p-1} \quad \text{exactly, for each fixed } i.

The tit_i for different ii are not independent. This needs the fit without ii to have rank pp, that is, hii<1h_{ii} < 1.

The internal version is bounded. Under the same model, ri2/(n−p)r_i^2/(n - p) has the Beta(12,n−p−12)\big(\frac12, \frac{n-p-1}{2}\big) law, so ∣ri∣≤n−p|r_i| \le \sqrt{n - p} always. A single wild point cannot have a large rir_i in a small sample, because it also inflates ss. This is the reason to prefer tit_i for outlier detection: tit_i is a monotone function of rir_i, but its scale is unbounded and its law is the familiar tt.

Mean shift outlier model. Add to XX the indicator column uiu_i of observation ii. The t statistic of its coefficient is exactly tit_i. So ∣ti∣≥t(n−p−1,1−α/2)|t_i| \ge t_{(n-p-1, 1-\alpha/2)} is the level α\alpha test that observation ii, chosen in advance, is shifted. For the largest ∣ti∣|t_i|, chosen after looking, the Bonferroni bound gives the cutoff t(n−p−1,1−α/(2n))t_{(n-p-1, 1-\alpha/(2n))}, which is conservative.

Examples and non-examples

Six points, one far in xx. Take x=(1,2,3,4,5,10)x = (1, 2, 3, 4, 5, 10) and y=(2,3,5,4,6,4)y = (2, 3, 5, 4, 6, 4) with p=2p = 2. The fit is y^=3.2623+0.1770 x\hat y = 3.2623 + 0.1770\,x, s2=641/305=2.1016s^2 = 641/305 = 2.1016 and n−p−1=3n - p - 1 = 3. Exact arithmetic, checked by refitting without each point:

ii xix_i hiih_{ii} eie_i rir_i s(i)2s_{(i)}^2 tit_i
1 1 0.3639 −1.4393-1.4393 −1.2449-1.2449 1.7165 −1.3775-1.3775
2 2 0.2590 −0.6164-0.6164 −0.4939-0.4939 2.6313 −0.4414-0.4414
3 3 0.1934 1.2066 0.9267 2.2005 0.9057
4 4 0.1672 0.0295 0.0223 2.8018 0.0193
5 5 0.1803 1.8525 1.4114 1.4067 1.7252
6 10 0.8361 −1.0328-1.0328 −1.7595-1.7595 0.6333 −3.2052-3.2052

The sixth raw residual is the third smallest in size, yet its studentized residuals are the largest: 1−0.8361=0.405\sqrt{1 - 0.8361} = 0.405 scales it up by 2.5, and leaving it out drops the variance estimate from 2.10 to 0.63. Its internal value −1.76-1.76 is close to the bound n−p=2\sqrt{n - p} = 2. Its external value −3.21-3.21 has two-sided p-value 0.049 against t3t_3, just under 0.05 for a point chosen in advance. Chosen as the largest of six, the Bonferroni p-value is min⁡(1,12⋅0.0246)=0.295\min(1, 12 \cdot 0.0246) = 0.295, and the Bonferroni cutoff is t(3,1−0.05/12)=6.23t_{(3, 1 - 0.05/12)} = 6.23. With n=6n = 6 the data cannot prove an outlier, which is the honest answer.

The identity between rir_i and tit_i. For point 6, −1.75953/(4−1.75952)=−3.2050-1.7595\sqrt{3/(4 - 1.7595^2)} = -3.2050, which agrees with the refit value up to the rounding of r6r_6.

Non-example: ei/se_i/s. Dividing by ss alone ignores 1−hii1 - h_{ii}. For point 6 it gives −0.71-0.71, which hides the point. Some software calls ei/se_i/s the standardized residual, so check the definition before reading a plot.

Non-example: residuals of a robust fit. For an M-estimator such as the Huber M-estimator, eie_i divided by a robust scale is a useful residual, but it has neither of the exact laws above.

Naming. The terms vary between books and programs. "Studentized" usually means tit_i (external) and "standardized" means rir_i (internal), but some texts call rir_i studentized. "Deleted residual" can mean tit_i or the unscaled di=ei/(1−hii)d_i = e_i/(1 - h_{ii}).

  • PRESS statistic. ∑idi2=∑iei2/(1−hii)2\sum_i d_i^2 = \sum_i e_i^2/(1 - h_{ii})^2, the leave-one-out prediction error sum of squares; leave-one-out cross-validation for least squares is PRESS/n/n. For the example it is 52.85, against the in-sample RSS=8.41\mathrm{RSS} = 8.41.
  • Cook's distance. Di=ri2phii1−hiiD_i = \frac{r_i^2}{p}\frac{h_{ii}}{1 - h_{ii}}, the internal residual times a leverage factor.
  • DFFITS. tihii/(1−hii)t_i\sqrt{h_{ii}/(1 - h_{ii})}, the external residual times the same kind of factor.
  • Q-Q plot of residuals. Plotting the ordered tit_i against tn−p−1t_{n-p-1} or normal quantiles checks the normality of the errors; the raw eie_i have unequal variances and are less suited.
  • Studentization. Dividing a statistic by an estimate of its standard deviation, after Student, as in the t-test. The residuals are "studentized" in the same sense.

References

  1. George A. F. Seber and Alan J. Lee, Linear Regression Analysis, second edition, Wiley, 2003, Section 10.2 (residuals, their variances and the internally and externally studentized residuals) and Section 10.6.3 (leave-one-out diagnostics)
  2. R. Dennis Cook and Sanford Weisberg, Residuals and Influence in Regression, Chapman and Hall, 1982, Chapter 2 (diagnostic methods using residuals, the studentized residuals, the mean shift outlier model and the Bonferroni outlier test)
  3. David A. Belsley, Edwin Kuh and Roy E. Welsch, Regression Diagnostics, Wiley, 1980, Chapter 2 (the studentized residual RSTUDENT with the deleted variance estimate s(i))

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/NDSGPG/text.yaml