1
$\begingroup$

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

$\endgroup$

1 Answer 1

4
$\begingroup$

v1 = v2 + v3. So there is a redundant predictor causing a singular regression.

$\endgroup$
1
  • $\begingroup$ Thank you for your response. It helped me in solving the problem. $\endgroup$
    – Niels
    May 12, 2020 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.