I am currently having some issues with the thetaf function in R (Which is from the 'Forecast' package.) The idea is that I am trying to create a forecast based on a tsibble from the previous year. The tsibble itself is daily. I have checked with the is.tsibble function if it is a tsibble and the answer is yes.
> is_tsibble(Daily_Tsibble2017)
[1] TRUE
When using the thetaf function, I get the following.
> thetaf(Daily_Tsibble2017,h = 365)
Error in complete.cases(x, y, wt) :
not all arguments have the same length
Since someone kindly commented on how to improve this post, I will give a short example. Since the thetaf function does need a tsibble to work, I create one first.
> tsibble(
+ Year = 1:10,
+ Items = c(1, 4, 5, 6, 12, 18, 20, 45, 19, 13),
+ index = Year
+ ) -> Test_Tsibble
If I then run the thetaf function it gives me the following error
> thetaf(Test_Tsibble,h=10)
Error in complete.cases(x, y, wt) :
not all arguments have the same length
Now, I do have to admit that this is my first time with the thetaf function so I would not be surprised if it is a basic mistake but I would really appreciate an answer and a solution to this issue of mine.
The forecast package functions, including thetaf()
, use ts
objects not tsibble
objects.
If you want to use a tsibble
object, then you can use the fable::THETA()
function to fit the model.
If you want to use the forecast::thetaf()
function, then convert your tsibble
object to a ts
object.