I'm working with the forecast package (version 8.5) in R (version 3.5.3), attempting to do some ARIMA forecasting using the magnificent auto.arima() function.
When running this function, I always receive an error code which says, "Error in eval(expr, p) : object 'fitxreg' not found". I have already tried debugging, and I wasn't able to figure out exactly what the problem was, but when I revert back to forecast 8.4, this block of code works without an issue.
arimaIssue <- function(fitxreg = NULL, forxreg = NULL){
library(forecast)
fit <- auto.arima(AirPassengers[1:87],
seasonal = FALSE,
xreg = fitxreg, lambda = 'auto', allowmean = TRUE)
fcast <- forecast(fit, xreg = forxreg, h = 3)
return(fcast)
}
arimaIssue()
I would expect this to return a forecast object from auto.arima() that does not use external regressors (note that both fitxreg and forxreg are NULL). However, I simply get the error described above.
Any help is greatly appreciated!