Error in solve.default(res$hessian * n.used) :Lapack routine dgesv: system is exactly singular

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in solve.default(res$hessian * n.used) :Lapack routine dgesv: system is exactly singular

Vinicius Magalhães
Hi there!

I´m a noob when it comes to R and I´m using it to run statisc analysis.

With the code for ARIMA below I´m getting this error: Error in
solve.default(res$hessian * n.used) :Lapack routine dgesv: system is
exactly singular

The code is:

> s.ts <- ts(x[,7], start = 2004, fre=12)
> get.best.arima <- function (x.ts, maxord=c(1,1,1,1,1,1))
+ {
+ best.aic <- 1e8
+ n <- length(x.ts)
+ for (p in 0:maxord[1]) for (d in 0:maxord[2]) for (q in 0:maxord[3])
+  for (P in 0:maxord[4]) for (D in 0:maxord[5]) for (Q in 0:maxord[6])
+  {
+ fit <- arima(x.ts, order=c(p,d,q),
+     seas = list(order=c(P,D,Q),
+     frequency(x.ts)), method = "CSS")
+ fit.aic <- -2 * fit$loglik + (log(n) + 1) * length(fit$coef)
+ if (fit.aic < best.aic)
+ {
+ best.aic <- fit.aic
+ best.fit <- fit
+ best.model <- c(p,d,q,P,D,Q)
+ }
+ }
+ list(best.aic,best.fit,best.model)
+ }
> best.arima.ss <- get.best.arima(log(s.ts),maxord = c(2,2,2,2,2,2))

Error in solve.default(res$hessian * n.used) :
  Lapack routine dgesv: system is exactly singular


> s.ts

                 Jan         Feb        Mar        Apr        May
Jun          Jul         Aug
2004 143.0000 160.0000 205.0000 180.0000 160.0000 160.0000 155.0000 160.0000
2005 148.0000 185.0000 195.0000 195.0000 175.0000 175.0000 170.0000 165.0000
2006 188.0000 203.0000 213.0000 198.0000 180.0000 180.0000 190.0000 188.0000
2007 168.0000 200.0000 210.0000 185.0000 175.0000 190.0000 190.0000 193.0000
2008 167.0000 190.0000 210.0000 205.0000 190.0000 190.0000 200.0000 175.0000
               Sep         Oct         Nov         Dec
2004 150.0000 140.0000 135.0000 150.0000
2005 160.0000 155.0000 155.0000 153.0000
2006 193.0000 184.0000 170.0000 165.0000
2007 180.0000 180.0000 175.0000 165.0000
2008 175.0000 165.0000 161.6667 161.6667


--
Vinicius Macedo Magalhães
(21) 9584-1533

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Error in solve.default(res$hessian * n.used) :Lapack routine dgesv: system is exactly singular

VictorDelgado
Vinicius,

Vinicius Magalhães wrote
+ n <- length(x.ts)
+ for (p in 0:maxord[1]) for (d in 0:maxord[2]) for (q in 0:maxord[3])
+  for (P in 0:maxord[4]) for (D in 0:maxord[5]) for (Q in 0:maxord[6])
+  {
+ fit <- arima(x.ts, order=c(p,d,q),
+     seas = list(order=c(P,D,Q),
+     frequency(x.ts)), method = "CSS")
+ fit.aic <- -2 * fit$loglik + (log(n) + 1) * length(fit$coef)
I think you are using 'x.ts' instead 's.ts'. Is it correct?!
Maybe you can also put here objects likely 'x', 'x.ts' to help us give feedback to you routine.

Best regards.
Victor Delgado Professor in department of Economics, UFOP - Univ. Federal de Ouro Preto, Brazil