Hmisc (version 3.0-10)

abs.error.pred: Indexes of Absolute Prediction Error for Linear Models

Description

Computes the mean and median of various absolute errors related to ordinary multiple regression models. The mean and median absolute errors correspond to the mean square due to regression, error, and total. The absolute errors computed are derived from Yhat - median(Yhat), Yhat - Y, and Y - median(Y). The function also computes ratios that correspond to Rsquare and 1 - Rsquare (but these ratios do not add to 1.0); the Rsquare measure is the ratio of mean or median absolute Yhat - median(Yhat) to the mean or median absolute Y - median(Y). The 1 - Rsquare or SSE/SST measure is the mean or median absolute Yhat - Y divided by the mean or median absolute Y - median(Y).

Usage

abs.error.pred(fit, lp=NULL, y=NULL)

## S3 method for class 'abs.error.pred': print(x, \dots)

Arguments

fit
a fit object typically from lm or ols that contains a y vector (i.e., you should have specified y=TRUE to the fitting function) unless the y argument is given to abs.error.pred.
lp
a vector of predicted values (Y hat above) if fit is not given
y
a vector of response variable values if fit (with y=TRUE in effect) is not given
x
an object created by abs.error.pred
...
unused

Value

  • a list of class abs.error.pred (used by print.abs.error.pred) containing two matrices: differences and ratios.

concept

predictive accuracy

References

Schemper M (2003): Stat in Med 22:2299-2308.

See Also

lm, ols, cor, validate.ols

Examples

Run this code
set.seed(1)         # so can regenerate results
x1 <- rnorm(100)
x2 <- rnorm(100)
y  <- exp(x1+x2+rnorm(100))
f <- lm(log(y) ~ x1 + poly(x2,3), y=TRUE)
abs.error.pred(lp=exp(fitted(f)), y=y)
rm(x1,x2,y,f)

Run the code above in your browser using DataCamp Workspace