Learn R Programming

scorer (version 0.1.0)

mae: Calculate mean absolute error between actual and forecast.

Description

mae takes actual and forecast numeric vectors and returns a numeric vector where forecast is subtracted from the actual, the absolute value is taken of those errors, and lastly, the mean is taken of those absolute erros.

Usage

mae(actual, forecast, na.rm = TRUE, ...)

Arguments

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 representing the mean of absolute errors.

Examples

Run this code
# Examples
mae(1:100, 100:1)

Run the code above in your browser using DataLab