Learn R Programming

plgraphics (version 1.2)

stdresiduals: Get Standardized Residuals

Description

Calculates standardized residuals and leverage values.

Usage

stdresiduals(x, residuals=NULL, sigma=x$sigma, weights=NULL,
             leveragelimit = NULL)

Value

vector or matrix of standardized residuals, with attributes

attr(.,"stdresratio"): ratio of standardized / unstandardized residuals,

attr(.,"leverage"): leverage (hat) values,

attr(.,"weighted"): weights used in the standardization,

attr(.,"stddev"): error standard deviation or scale parameter.

Arguments

x

a fitted model object

residuals

unstandardized residuals. If missing, they are obtained from x

sigma

error standard deviation or other scale

weights

weights

leveragelimit

scalar a little smaller than 1: limit on leverage values to avoid unduely large or infinite standardized residuals

Author

Werner A. Stahel, ETH Zurich

Details

The difference to stdres() from package MASS is that stdresiduals also applies to multivariate regression and can be used with regression model fits not inheriting from lm.

The function uses the qr decomposition of object. If necessary, it generates it.

See Also

Examples

Run this code
data(d.blast)
r.blast <-
  lm(log10(tremor)~location+log10(distance)+log10(charge), data=d.blast)
t.stdr <- stdresiduals(r.blast)
showd(t.stdr)
showd(attr(t.stdr, "leverage"))

Run the code above in your browser using DataLab