Vinicius Magalhães
2012-Feb-28 12:58 UTC
[R] Error in solve.default(res$hessian * n.used) :Lapack routine dgesv: system is exactly singular
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.tsJan 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]]
VictorDelgado
2012-Mar-01 14:08 UTC
[R] Error in solve.default(res$hessian * n.used) :Lapack routine dgesv: system is exactly singular
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 cedeplar.ufmg.br P.H.D. student www.fjp.mg.gov.br reseacher -- View this message in context: http://r.789695.n4.nabble.com/Error-in-solve-default-res-hessian-n-used-Lapack-routine-dgesv-system-is-exactly-singular-tp4428273p4435054.html Sent from the R help mailing list archive at Nabble.com.