Learn R Programming

StatMeasures (version 1.0)

mape: Compute mean absolute percentage error

Description

Takes in actual and predicted linear response, and returns MAPE value

Usage

mape(y, yhat)

Arguments

y
actual linear response
yhat
predicted linear response

Value

mean absolute percentage error

Details

mape calculates the mean absolute percentage error in a predicted linear response.

See Also

actvspred, splitdata

Examples

Run this code
# A 'data.frame' with y and yhat
 df <- data.frame(y = c(1.5, 2, 3.2),
                  yhat = c(3.4, 2.2, 2.7))

# Compute mape
MAPE <- mape(y = df[, 'y'], yhat = df[, 'yhat'])

Run the code above in your browser using DataLab