# How to fit an ARMAX model with more than one exogenous time series?

I am trying to fit an ARMAX with two exogenous time series with the following code but it gives me an "computationally singular" error. I know it is about defining more than 2 time series for xreg because when I include only one exogenous it works! This is link for data

library(forecast)

Y1=ts(data[,1], start=1978, frequency=12)

#exogenous time series
Y2<-matrix(0,360,2)
Y2[,1]<-cbind(data[,2])
Y2[,2]<-cbind(data[,3])

model<- arima (Y1, order=c(1, 0, 0), xreg=as.ts(Y2, start=1978, frequency=12))

predict (model, 10, newxreg=0)


I get this Error:

 in solve.default(res$hessian * n.used, A) : system is computationally singular: reciprocal condition number = 5.67866e-34  • What do the values of data[,2] and data[,3] look like? Do the values of either data[,2] or data[,3] tend to be close to zero? Are the values of data[,2] - data[,3] close to zero? – Blue Marker Sep 19 '14 at 20:35 • @BlueMarker Thank you for your comment I looked at my data again and I found out problem was there and now it is solved I will remove the question shortly – Fred Sep 19 '14 at 21:05 ## 1 Answer There is a perfect correlation between the regressors, Y[,1] is$2.5\$ times Y[,2].

all.equal(Y2[,1], Y2[,2] * 2.5)
# [1] TRUE
cor(Y2[,1], Y2[,2])
#[1] 1


This makes the Hessian matrix non-invertible. The same problem will arise in a linear regression since the crossproduct of the matrix of regressors Y2'Y2 is not invertbible and hence the Ordinary Least Square estimator cannot be computed.

det(crossprod(Y2))
# [1] -5.464545e-12
solve(crossprod(Y2))
# Error in solve.default(crossprod(Y2)) :
#   system is computationally singular: reciprocal condition number = 2.30218e-17


One of the regressors does not contribute new information so you can stick to include only one of the regressors.