MAPE: 'MAPE()' calculate mean absolute percentage error

Description Usage Arguments Value Author(s) See Also Examples

View source: R/MAPE.R

Description

MAPE() calculate mean absolute percentage error

Usage

1
MAPE(obs, pred, response, ...)

Arguments

obs

A numeric vector or matrix, the observed data. Can be continuous values or dicrete. Can be aggregated, and if so you must supply n (see below). The default assumes raw data.

pred

A numeric vector or matrix with predictions, in the same order as obs.

response

(default "discrete") A string with response format, "continuous" or "discrete" (e.g., choices). Can be abbreviated. Will be inferred if missing from obs, pred.

...

more arguments to be passed on to the fitting functions, see e.g. loglikelihood()

Value

Mean absolute percentage error between obs and pred

Author(s)

Jana B. Jarecki, jj@janajarecki.com, Florian Seitz

See Also

Other goodness of fit functions: APE(), Accuracy(), MDAPE(), MSE(), RMSE(), SSE(), gof()

Examples

1
2
3
4
5
6
7
# First example from Gilliland, M. (2010). 
# The business forecasting deal: exposing myths, eliminating bad practices,
# providing practical solutions (Vol. 27). John Wiley & Sons. (Exhibit A.3):

pred <- rep(1250, 6)
obs <- c(1150, 1400, 1200, 1350, 1100, 1300)
MAPE(obs, pred, response = "con")

JanaJarecki/cognitiveutils documentation built on Sept. 9, 2020, 9:11 a.m.