Hi. i am having this issue when using forecast function with Arima and exogenous variables.However, predict function gives some results.
No regressors provided
in addition:Warning message:
The non-existent newxreg arguments will be ignored
i am trying to forecast 12 years ahead "loss" considering the exogenous variable "har". Here is the attempt.
harw<- cbind(
ArLag0 = har,
ArLag1 = stats::lag(har,-1))%>%
head(NROW(har))
fit=Arima(loss,order=c(1,2,1),xreg=harw[,1:2])
exvector is the future values of the exogenous variable which has been forecasted separetely.
exvector=ts(har[c(54:65),]$value,start = min(har[c(54:65),]$year),frequency=1)
t=exvector
y=c(harw[53,1],exvector[1:11])
newdat=cbind(ArLag0=exvector, ArLag1=y)
fit_loss=forecast(fit,newxreg=newdat)
Referred here by Forecasting: Principles and Practice, by Rob J Hyndman and George Athanasopoulos