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.
Service: forecasting and statistical studies Research note: intermittent demand forecasting, measured
References
- Gneiting, T. (2011). Making and evaluating point forecasts. Journal of the American Statistical Association, 106(494), 746-762. doi:10.1198/jasa.2011.r10138
- 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
- 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