robjhyndman / forecast

Forecasting Functions for Time Series and Linear Models
http://pkg.robjhyndman.com/forecast
1.11k stars 341 forks source link

Theil-U statistic in accuracy #926

Closed leonardocad1 closed 1 year ago

leonardocad1 commented 1 year ago

Hi,

I am looking for the U-theil statistic in the accuracy function for my forecast. I have read in some blogs that it used to be there, now it goes as far as ACF1. My question is that if there ever was a version of package forecast including that statistic.

Appreciate it.

Thanks, Leonardo

robjhyndman commented 1 year ago

It is still there. See https://github.com/robjhyndman/forecast/blob/5cb1510af7a165c9511764dfbf16d199029f609a/R/errors.R#L90

library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
fit <- USAccDeaths |> 
  head(-12) |> 
  ets() |> 
  forecast(h = 12)
fit |> 
  accuracy(USAccDeaths)
#>                     ME     RMSE      MAE        MPE     MAPE      MASE
#> Training set -13.93735 273.0557 213.8886 -0.2274330 2.459003 0.4440401
#> Test set     100.36430 289.6213 230.7505  0.9037096 2.659729 0.4790461
#>                     ACF1 Theil's U
#> Training set -0.01003205        NA
#> Test set      0.46386669 0.4068763

Created on 2022-12-01 with reprex v2.0.2