Learn R Programming

statpsych (version 1.7.0)

ci.mape: Confidence interval for a mean absolute prediction error

Description

Computes a confidence interval for a population mean absolute prediction error (MAPE) in a general linear model. The MAPE is a more robust alternative to the residual standard deviation. This function requires a vector of estimated residuals from a general linear model. This confidence interval does not assume zero excess kurtosis but does assume symmetry of the population prediction errors.

Usage

ci.mape(alpha, res, s)

Value

Returns a 1-row matrix. The columns are:

  • Estimate - estimated mean absolute prediction error

  • SE - standard error

  • LL - lower limit of the confidence interval

  • UL - upper limit of the confidence interval

Arguments

alpha

alpha level for 1-alpha confidence

res

vector of residuals

s

number of predictor variables in model

Examples

Run this code
res <- c(-2.70, -2.69, -1.32, 1.02, 1.23, -1.46, 2.21, -2.10, 2.56,
      -3.02, -1.55, 1.46, 4.02, 2.34)
ci.mape(.05, res, 1)

# Should return:
# Estimate        SE       LL       UL
#   2.3744 0.3314752 1.751678 3.218499
 

Run the code above in your browser using DataLab