Compute mean absolute percentage error

Description

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

Usage

1
mape(y, yhat)

Arguments

y

actual linear response

yhat

predicted linear response

Details

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

Value

mean absolute percentage error

Author(s)

Akash Jain

See Also

actvspred, splitdata

Examples

1
2
3
4
5
6
# 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'])