How to convert a forecast object into a matrix? so that I can use the forecast output as a co-variate to the auto.arima function.
When I use the forecast output as one of the co-variate to my auto.arima function it throws an error- Error in forecast.forecast_ARIMA(bestfit, xreg = cbind(fourier.bestfit, :
xreg should be a numeric matrix or a numeric vector)
The forecast object is a list. You probably want the point forecast (the mean of the forecast distribution) to use as a covariate, which is stored as mean in the forecast object. So here is some code that forecasts mdeaths as a function of fdeaths.
While that works, it ignores the uncertainty in the forecasts of the covariates. A better approach would take that uncertainty into account by simulating future sample paths of the covariates and using those to simulate future sample paths of the main variable.
Thank you Sir. I did that as I happen to find the mean from the forecast object after I post this question and as you rightly said I have predicted the future values of the co-variate first and used that as a regressor to the main variable.
I have been reading your books and it is highly helpful. Thank you for guiding us through.