Search code examples
rtime-seriesforecast

Output issues with the thetaf function


I am currently working with the thetaf function from the forecast package and while I am getting an output, it is an output that I can not work with. The ts object that I use as the input for the thetaf function is a daily timeseries for the whole duration of a year and I want to create a forecast for the next year.

However, the output that I get is rather odd. Specifically, the dates are a bit strange. Such as 2018.0000, etc.

> thetaf(Daily_Time_2017,h=365)
          Point Forecast     Lo 80    Hi 80     Lo 95    Hi 95
2018.0000       26.60391 0.8104595 52.39736 -12.84377 66.05159
2018.0027       26.64246 0.8302117 52.45471 -12.83397 66.11889
2018.0055       26.68101 0.8499777 52.51204 -12.82414 66.18616
2018.0082       26.71956 0.8697573 52.56936 -12.81430 66.25342

I suspect that perhaps it has something to with the daily ts object as the forecast is fine with a monthly ts.


Solution

  • ts objects store the time attribute using three numbers: start, end and frequency. The actual time or date in displays or graphs are created on the fly. This works ok for annual, quarterly or monthly data, but starts to break down for more frequent observations. In this example, the number shown as the date is the year, plus the fraction of the year so far.

    That's one of the reasons we developed the tsibble format, which allows explicit dates and times.

    You can fit a Theta model to data stored in a tsibble object, with the fable::THETA() function.