robjhyndman / forecast

Forecasting Functions for Time Series and Linear Models
http://pkg.robjhyndman.com/forecast
1.1k stars 340 forks source link

Autoarima error: "Lapack routine dgesv: system is exactly singular: U[1,1] = 0". #887

Closed orestiskaitezidis closed 2 years ago

orestiskaitezidis commented 2 years ago

Hi Professor @robjhyndman, could you please advice why the following time-series fails with the error "Error in solve.default(res$hessian * n.used, A) : Lapack routine dgesv: system is exactly singular: U[1,1] = 0" when using auto-arima? The rank of the xreg matrix is equal to 6 (and the shape of the xreg matrix is (14,6)). Thank you for your time.


time_series=ts(c(8L, 0L, 0L, 0L, 0L, 0L, 0L, 8L, 0L, 0L, 0L, 0L, 0L, 0L), frequency=7)
xreg = structure(c(0.78183148246803, 0.974927912181824, 0.433883739117558, 
                   -0.433883739117558, -0.974927912181824, -0.78183148246803, 0, 
                   0.781831482468029, 0.974927912181824, 0.433883739117559, -0.433883739117558, 
                   -0.974927912181824, -0.78183148246803, 0, 0.623489801858734, 
                   -0.222520933956314, -0.900968867902419, -0.900968867902419, -0.222520933956315, 
                   0.623489801858733, 1, 0.623489801858734, -0.222520933956313, 
                   -0.900968867902418, -0.900968867902419, -0.222520933956315, 0.623489801858733, 
                   1, 0.974927912181824, -0.433883739117558, -0.78183148246803, 
                   0.781831482468029, 0.433883739117559, -0.974927912181824, 0, 
                   0.974927912181824, -0.433883739117557, -0.781831482468031, 0.781831482468029, 
                   0.433883739117559, -0.974927912181823, 0, -0.222520933956314, 
                   -0.900968867902419, 0.623489801858733, 0.623489801858734, -0.900968867902418, 
                   -0.222520933956315, 1, -0.222520933956313, -0.90096886790242, 
                   0.623489801858731, 0.623489801858734, -0.900968867902418, -0.222520933956316, 
                   1, 0.433883739117558, -0.78183148246803, 0.974927912181824, -0.974927912181824, 
                   0.781831482468029, -0.433883739117557, 0, 0.433883739117559, 
                   -0.781831482468031, 0.974927912181824, -0.974927912181824, 0.781831482468028, 
                   -0.433883739117557, 0, -0.900968867902419, 0.623489801858733, 
                   -0.222520933956313, -0.222520933956315, 0.623489801858734, -0.90096886790242, 
                   1, -0.900968867902418, 0.623489801858731, -0.222520933956313, 
                   -0.222520933956314, 0.623489801858736, -0.90096886790242, 1), .Dim = c(14L, 
                                                                                          6L), .Dimnames = list(NULL, c("S1-7", "C1-7", "S2-7", "C2-7", 
                                                                                                                        "S3-7", "C3-7")))
auto.arima(time_series, xreg = xreg)
robjhyndman commented 2 years ago

You have a complete set of Fourier terms and an exactly periodic series. So the model has no error.