| residuals.ols {rms} | R Documentation | 
Residuals for ols
Description
Computes various residuals and measures of influence for a
fit from ols.
Usage
## S3 method for class 'ols'
residuals(object, 
      type=c("ordinary", "score", "dfbeta", "dfbetas", 
             "dffit", "dffits", "hat", "hscore", "influence.measures",
             "studentized"), ...)
Arguments
| object | object created by ols.  Depending ontype, you may have had to
specifyx=TRUEtools. | 
| type | type of residual desired.  "ordinary"refers to the usual residual."score"is the matrix of score residuals (contributions to first
derivative of log likelihood).dfbetaanddfbetasmean respectively the raw and normalized matrix of changes in regression coefficients after
deleting in turn each observation.  The coefficients are normalized by their
standard errors.hatcontains the leverages — diagonals of the “hat” matrix.dffitanddffitscontain respectively the difference and normalized
difference in predicted values when each observation is omitted. 
The Slm.influencefunction is used.  Whentype="hscore", the
ordinary residuals are divided by one minus the corresponding hat
matrix diagonal element to make residuals have equal variance.  Whentype="influence.measures"the model is converted to anlmmodel andinfluence.measures(object)$infmatis
returned.  This is a matrix with dfbetas for all predictors, dffit,
cov.r, Cook's d, and hat.  Fortype="studentized"studentized leave-out-one residuals are computed.
See the help file forinfluence.measuresfor more details. | 
| ... | ignored | 
Value
a matrix or vector, with places for observations that were originally
deleted by ols held by NAs 
Author(s)
Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com
See Also
lm.influence, ols,
which.influence 
Examples
set.seed(1)
x1 <- rnorm(100)
x2 <- rnorm(100)
x1[1] <- 100
y <- x1 + x2 + rnorm(100)
f <- ols(y ~ x1 + x2, x=TRUE, y=TRUE)
resid(f, "dfbetas")
which.influence(f)
i <- resid(f, 'influence.measures') # dfbeta, dffit, etc.
[Package 
rms version 6.8-1 
Index]