stdresiduals: Get Standardized Residuals

stdresidualsR Documentation

Get Standardized Residuals

Description

Calculates standardized residuals and leverage values.

Usage

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

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

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.

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.

Author(s)

Werner A. Stahel, ETH Zurich

See Also

stdres; hat; hatvalues; influence

Examples

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"))

plgraphics documentation built on Oct. 19, 2023, 3 p.m.