Description Usage Arguments Details Value Author(s) References See Also Examples
Compute the prediction loss of a model.
1 2 3 4 5 6 7 8 9 |
y |
a numeric vector or matrix giving the observed values. |
yHat |
a numeric vector or matrix of the same
dimensions as |
trim |
a numeric value giving the trimming proportion (the default is 0.25). |
includeSE |
a logical indicating whether standard errors should be computed as well. |
mspe and rmspe compute the mean squared
prediction error and the root mean squared prediction
error, respectively. In addition, mape returns
the mean absolute prediction error, which is somewhat
more robust.
Robust prediction loss based on trimming is implemented
in tmspe and rtmspe. To be more precise,
tmspe computes the trimmed mean squared prediction
error and rtmspe computes the root trimmed mean
squared prediction error. A proportion of the largest
squared differences of the observed and fitted values are
thereby trimmed.
Standard errors can be requested via the includeSE
argument. Note that standard errors for tmspe are
based on a winsorized standard deviation. Furthermore,
standard errors for rmspe and rtmspe are
computed from the respective standard errors of
mspe and tmspe via the delta method.
If standard errors are not requested, a numeric value giving the prediction loss is returned.
Otherwise a list is returned, with the first component containing the prediction loss and the second component the corresponding standard error.
Andreas Alfons
Tukey, J.W. and McLaughlin, D.H. (1963) Less vulnerable confidence and significance procedures for location based on a single sample: Trimming/winsorization. Sankhya: The Indian Journal of Statistics, Series A, 25(3), 331–352
Oehlert, G.W. (1992) A note on the delta method. The American Statistician, 46(1), 27–29.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # fit an MM-regression model
data("coleman")
fit <- lmrob(Y~., data=coleman)
# compute the prediction loss from the fitted values
# (hence the prediction loss is underestimated in this simple
# example since all observations are used to fit the model)
mspe(coleman$Y, predict(fit))
rmspe(coleman$Y, predict(fit))
mape(coleman$Y, predict(fit))
tmspe(coleman$Y, predict(fit), trim = 0.1)
rtmspe(coleman$Y, predict(fit), trim = 0.1)
# include standard error
mspe(coleman$Y, predict(fit), includeSE = TRUE)
rmspe(coleman$Y, predict(fit), includeSE = TRUE)
mape(coleman$Y, predict(fit), includeSE = TRUE)
tmspe(coleman$Y, predict(fit), trim = 0.1, includeSE = TRUE)
rtmspe(coleman$Y, predict(fit), trim = 0.1, includeSE = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.