Search code examples
rforecasting

Forecast accuracy: no MASE with two vectors as arguments


I'm using the accuracy function from the forecast package, to calculate accuracy measures. I'm using it to calculate measures for fitted time series models, such as ARIMA or exponential smoothing. As I'm testing different model types on different dimensions and aggregation levels, I'm using the MASE, mean absolute scaled error, introduced by Hyndman et al (2006, "Another look at measures of forecast accuracy"), to compare different models on different levels.

Now I'm also comparing models with forecast history. As I only have the forecast values and not the models, I tried to use the accuracy function. In the function description is mentioned that it is also allowed provide two vector arguments, one with forecast values and one with actuals, to calculate the measures (instead of a fitted model):

f: An object of class "forecast", or a numerical vector containing forecasts. It will also work with Arima, ets and lm objects if x is omitted – in which case in-sample accuracy measures are returned.

x: An optional numerical vector containing actual values of the same length as object.

But I was suprised by the fact that all measures are returned, expect the MASE. So I was wondering if somebody knows what the reason is for that? Why is the MASE not returned, while using two vectors as arguments in the accuracy function?


Solution

  • The MASE requires the historical data to compute the scaling factor. It is not computed from the future data as in the answer by @FBE. So if you don't pass the historical data to accuracy(), the MASE cannot be computed. For example,

    > library(forecast)
    > fcast <- snaive(window(USAccDeaths,end=1977.99))
    > accuracy(fcast$mean,USAccDeaths)
             ME        RMSE         MAE         MPE        MAPE        ACF1 
    225.1666667 341.1639391 259.5000000   2.4692164   2.8505546   0.3086626 
      Theil's U 
      0.4474491 
    

    But if you pass the whole fcast object (which includes the historical data), you get

    > accuracy(fcast,USAccDeaths)
             ME        RMSE         MAE         MPE        MAPE        MASE 
    225.1666667 341.1639391 259.5000000   2.4692164   2.8505546   0.5387310 
           ACF1   Theil's U 
      0.3086626   0.4474491