Calculate mean absolute percent error between actual and forecast.

Share:

Description

mape takes actual and forecast numeric vectors and returns a numeric vector where forecast is subtracted from the actual and then those errors are divided by the actuals, the absolute value of those percent errors are then taken, and lastly, the mean of those absolute percent errors are taken.

Usage

1
2
mape(y_true = NULL, y_pred = NULL, actual = NULL, forecast = NULL,
  na.rm = TRUE, ...)

Arguments

y_true

Ground truth (correct) target values.

y_pred

Estimated target values.

actual

a numeric vector of actuals.

forecast

a numeric vector of forecasts.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

...

additional arguments to be passed to mean()

Value

a numeric vector of length one: the mean of of absolute percent errors.

Examples

1
2
# Examples
mape(1:100, 100:1)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.