X.residuals

From HH v2.1-23
0th

Percentile

Residuals from the regression of each column of a data.frame against all the other columns.

Calculate the residuals from the regression of each column of a data.frame against all the other columns.

Keywords
regression
Usage
X.residuals(x, ...)

## S3 method for class 'default':
X.residuals(x, y.name, na.action = na.exclude, ...) ## x is a data.frame

## S3 method for class 'formula':
X.residuals(x, data, na.action = na.exclude, ...)   ## x is a formula

## S3 method for class 'lm':
X.residuals(x, na.action = na.exclude, ...)  ## x is a "lm" object computed with x=TRUE
Arguments
x
data.frame, or formula, or lm object computed with x=TRUE.
na.action
See na.action.
...
y.name
Name of Y-variable to be excluded from the computations.
data
A data frame in which the variables specified in the formula will be found. If missing, the variables are searched for in the standard way.
Value

• Data.frame of residuals, one column from each regression.

References

Heiberger, Richard~M. and Holland, Burt (2004b). Statistical Analysis and Data Display: An Intermediate Course with Examples in S-Plus, R, and SAS. Springer Texts in Statistics. Springer. ISBN 0-387-40270-5.

lm in R or lm in S-Plus, vif, lm.case.

Aliases
• X.residuals
• X.residuals.default
• X.residuals.formula
• X.residuals.lm
Examples
usair <- read.table(hh("datasets/usair.dat"),
col.names=c("SO2","temp","mfgfirms","popn",
"wind","precip","raindays"))
usair$lnSO2 <- log(usair$SO2)
usair$lnmfg <- log(usair$mfgfirms)
usair$lnpopn <- log(usair$popn)

usair.lm <- lm(lnSO2 ~ temp + lnmfg + wind + precip, data=usair, x=TRUE)

X.residuals(usair.lm)  ## the lm object must be computed with x=TRUE

X.residuals(lnSO2 ~ temp + lnmfg + wind + precip, data=usair)

X.residuals(usair)

X.residuals(usair, y.name="lnSO2")
Documentation reproduced from package HH, version 2.1-23, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.