[R-sig-ME] standardized residuals

Douglas Bates bates at stat.wisc.edu
Wed Nov 10 17:48:34 CET 2010

```On Tue, Nov 9, 2010 at 9:13 PM, Dennis Murphy <djmuser at gmail.com> wrote:
> Hi:
>
> A standardized residual in (non-mixed) linear models has the form
>
>                                      e_i / (s * sqrt(1 - h_i)),
>
> where s is the (residual) standard deviation and h_i is the i-th element of
> the 'hat matrix'. h_i is also called the leverage that the i-th observation
> exerts on the model. You could look into the influence.ME package on CRAN to
> see if something like it has already been implemented, but if not, all you
> need is the hat matrix analogue of a mixed model and you can write it up
> yourself. You can get the residuals and residual standard deviation from a
> lme(r) object directly, and should be able to access the hat matrix, too,
> perhaps indirectly.

And, for a linear model or generalized linear model (without random
effects), which is stored as an S3 object, you can find the names of
methods specific to the class as
> methods(class="lm")
[5] case.names.lm*     confint.lm*        cooks.distance.lm* deviance.lm*
[9] dfbeta.lm*         dfbetas.lm*        drop1.lm*          dummy.coef.lm*
[13] effects.lm*        extractAIC.lm*     family.lm*         formula.lm*
[17] hatvalues.lm       influence.lm*      kappa.lm           labels.lm*
[21] logLik.lm*         model.frame.lm     model.matrix.lm    plot.lm
[25] predict.lm         print.lm           proj.lm*           qqnorm.lm*
[29] qr.lm*             residuals.lm       rstandard.lm       rstudent.lm
[33] simulate.lm*       summary.lm         variable.names.lm* vcov.lm*

Non-visible functions are asterisked
> methods(class="glm")
[4] cooks.distance.glm* deviance.glm*       drop1.glm*
[7] effects.glm*        extractAIC.glm*     family.glm*
[10] formula.glm*        influence.glm*      logLik.glm*
[13] model.frame.glm     predict.glm         print.glm
[16] residuals.glm       rstandard.glm       rstudent.glm
[19] summary.glm         vcov.glm*           weights.glm*

Non-visible functions are asterisked

from which you can see that there are functions called rstandard and
rstudent providing standardized or Studentized residuals in the stats
package.  That is, you do not need to use stdres.
>
> HTH,
> Dennis
>
> On Tue, Nov 9, 2010 at 9:05 AM, Michael Larkin <mlarkin at rsmas.miami.edu>wrote:
>
>> Anyone use the standardized residuals function in R?  It is called stdres
>>
>> I can't get it to work.  It tells me there is no documentation for stdres.
>> I am assuming there is a package that I need to load.  I looked at the list
>> of packages and I can't find one for stdres.  It must be bundled in some
>> package.
>>
>> Any advice on how I can get stdres to work would be greatly appreciated.
>>
>> Mike
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

```