I am trying to fit a dynamic forecasting model using auto.arima but I am getting the following error when trying to run my code:
'Error in solve.default(res$hessian * n.used, A) : Lapack routine dgesv: system is exactly singular: U[1,1] = 0'
Here is my code:
library(forecast) v1 <- c(1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) v2 <- c(0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) v3 <- c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) v4 <- c(1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) dynamicmatrix <- data.matrix(cbind(v1,v2,v3,v4)) dynamicmatrix ts <- ts(dynamicmatrix[,1], start=c(2036,2)) dynamicmatrix <- data.matrix(dynamicmatrix[,-1]) fit <- auto.arima(ts, xreg=dynamicmatrix)
The first column of dynamicmatrix contains the data that I want to forecast. The other 3 columns contain the data for xreg.
Does anyone know what might be causing this error?
Thank you, Niels