Shahab Einabadi
Shahab Einabadi

Reputation: 332

Error in predict.Arima(object, n.ahead = h) : 'xreg' and 'newxreg' have different numbers of columns

Why doesn't this code work? I tried it on another computer and it works fine but on my computer it gives error.

a <- matrix(rnorm(2000), ncol = 2)
b <- matrix(rnorm(20), ncol = 2)

da <- arima(rnorm(1000), order = c(1, 1, 1), seasonal = list(order = c(1, 1, 1), period = 24), xreg = a)

forecast(da, h = 10, xreg = b)

Error in predict.Arima(object, n.ahead = h) :
'xreg' and 'newxreg' have different numbers of columns
In addition: Warning message:
In forecast.Arima(da, h = 10, xreg = b) :
xreg not required by this model, ignoring the provided regressors

Upvotes: 0

Views: 1549

Answers (1)

Shahab Einabadi
Shahab Einabadi

Reputation: 332

I replaced arima with Arima and it seems that the problem is solved !!!

Upvotes: 1

Related Questions