On 08/10/2011 10:03 AM, Jen wrote:> Hi,
> I must be doing something silly here, because I can't get the
studentised
> and standardised residuals from r output of a linear model to agree with
> what I think they should be from equation form.
>
> x = seq(1,10)
> y = x + rnorm(10)
> mod = lm(y~x)
> rstandard(mod)
> residuals(mod)/(summary(mod)$sigma)
> rstudent(mod)
> residuals(mod)/(summary(mod)$sigma*sqrt(1-lm.influence(mod)$hat))
The terms "studentized" and "standardized" are sometimes
used
differently by different authors and software packages. In R, the
"standardized" residuals are based on your second calculation above.
The "studentized" residuals are similar, but involve estimating sigma
in
a way that leaves out the ith data point when calculating the ith
residual (some authors call these the "studentized deleted residuals"
or
the "externally studentized residuals"). There is a closed form
expression, but it is somewhat bulky.
--
Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky