Hello,
I don't see many posts here related to the library hts, but I'm hoping someone here is experienced in using the library for hierarchical forecasting. I am trying to apply the following code, which works with a normal ts object, using an hts object instead:
#Time series with period of 101 means fourier transform is the best way to deal with seasonality
data=ts(MyData,frequency=101)
fit <- auto.arima(data, xreg = fourier(data, K = 11),
seasonal = FALSE, lambda = 1)
When I do the same with an hts object, it won't accept the fourier transform as xreg, either applying fourier to the ts object:
> fcast<-forecast(data.hts, h=101, fmethod='arima', newxreg=fourier(data,K=11))
Or when applying it to the hts$bts:
> fcast<-forecast(data.hts, h=101, fmethod='arima', newxreg=fourier(data.hts$bts,K=11))
I get the same error:
Error in forecast.forecast_ARIMA(models, h = h, xreg = newxreg) :
Number of regressors does not match fitted model
If anyone has insight into this I would be very appreciative!
Thank you