Skip to content
Prev 241144 / 398500 Next

standardized/studentized residuals with loess

Hi Oliver,

As a warning, I may be missing something too.  I did not see something
explicit in base R or MASS.  In a quick scan of the fourth edition of
the MASS book, I did not read anything that it is
illogical/unreasonable to try to find standardized residuals (but my
knowledge of local regression approaches nil).  With that background,
I proceeded to blithely scavenge from other functions until I came up
with this:

loess.stdres <- function(model) {
  res <- model$residuals
  s <- sqrt(sum(res^2)/(length(res) - model$enp))
  stdres <- res/(sqrt(1 - hat(res)) * s)
  return(stdres)
}

## now for a half-baked check

## fit linear model and local regression
cars.lm <- lm(dist ~ speed, cars)
cars.lo <- loess(dist ~ speed, cars)

## these seem somewhat similar
rstandard(cars.lm)
c(scale(residuals(cars.lm)))

## these seem somewhat similar too
loess.stdres(cars.lo)
c(scale(cars.lo$residuals))


Cheers,

Josh



On Wed, Nov 10, 2010 at 9:24 AM, Oliver Frings
<oliverfrings at googlemail.com> wrote: