Library · Metric

MAE or RMSE: which forecast each one rewards

The absolute error is smallest when the forecast is the median of what can happen, the squared error when it is the mean. On skewed data these are different numbers, so the choice of measure is a choice of forecast.

By , published

Definition

The mean absolute error (MAE) averages the size of the errors. The root mean squared error (RMSE) squares them first, which gives more weight to large misses.

MAE = mean( |yt − ft| )    RMSE = √ mean( (yt − ft)2 )

A point forecast is a summary of a distribution, and each measure asks for a different summary. The expected absolute error is minimised by the median, the expected squared error by the mean. Gneiting calls this the consistency between a scoring function and the functional it elicits.

Worked example

Daily demand is skewed: most days are low, a few are high. We look for the constant forecast that each measure prefers.

import numpy as np

rng = np.random.default_rng(5)
demand = rng.gamma(shape=0.5, scale=20.0, size=100_000)     # mean 10, long right tail

grid = np.linspace(0, 25, 251)
mae = [np.mean(np.abs(demand - f)) for f in grid]
rmse = [np.sqrt(np.mean((demand - f) ** 2)) for f in grid]

print(f"mean of demand   = {demand.mean():.2f}")
print(f"median of demand = {np.median(demand):.2f}")
print(f"forecast with the lowest MAE  = {grid[int(np.argmin(mae))]:.1f}")
print(f"forecast with the lowest RMSE = {grid[int(np.argmin(rmse))]:.1f}")

Output, produced by running the code above when this page was built:

mean of demand   = 10.04
median of demand = 4.53
forecast with the lowest MAE  = 4.5
forecast with the lowest RMSE = 10.0

The forecast preferred by MAE is the median, less than half of the mean here. A replenishment plan built on it would supply less than half of the demand.

How to choose

Start from the use of the number. If forecasts are added up, over days to plan a month or over items to plan a warehouse, the sum of means is the mean of the sum, and a squared-error measure is the consistent choice. Medians do not add up. If a single typical value is wanted and large misses cost no more than proportionally, the absolute error fits.

For a decision with unequal costs of running short and holding too much, neither applies: the target is a quantile and the measure is the pinball loss. The scaled versions, MASE and RMSSE, inherit the same property as MAE and RMSE.

In our work

This distinction decided the reading of our intermittent demand study: methods ranked one way by absolute error and another way by squared error, because most series have a median of zero.

References

  1. Gneiting, T. (2011). Making and evaluating point forecasts. Journal of the American Statistical Association, 106(494), 746-762. doi:10.1198/jasa.2011.r10138
  2. Kolassa, S. (2016). Evaluating predictive count data distributions in retail sales forecasting. International Journal of Forecasting, 32(3), 788-803. doi:10.1016/j.ijforecast.2015.12.004
  3. Hyndman, R. J., Koehler, A. B. (2006). Another look at measures of forecast accuracy. International Journal of Forecasting, 22(4), 679-688. doi:10.1016/j.ijforecast.2006.03.001

Have a question like this one on your own data? Tell us what you need in a few lines.

Send us the brief

Related pages

  • MASE: mean absolute scaled errorMASE compares the absolute error of a forecast with the error a naive forecast made on the history. Below 1, the forecast beats that naive benchmark. On series that are mostly zeros, a forecast of zero gets the best score.
  • RMSSE: root mean squared scaled errorRMSSE is the square root of the squared forecast error divided by the squared error of a naive forecast on the history. It rewards forecasting the mean, which is what a stock calculation needs.
  • Pinball loss (quantile loss)The pinball loss, or quantile loss, is the measure for a quantile forecast, such as the stock level that covers demand 90 % of the time. It is minimised by the true quantile and by nothing else.
All library pages