Greetings, I am trying to fit a zero-inflated Poisson model using zeroinfl() from the pscl library. I have 5 covariates (4 continuous, 1 categorical); the categorical variable has 7 levels. I have had success fitting models that contain only the continuous covariates; however, when I add the categorical variable to any of the models (or if I run it by itself) I get the following error: Error in solve.default(as.matrix(fit$hessian)) : system is computationally singular: reciprocal condition number 3.46934e-20 The code I am using is: library(pscl) f1 <- formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER + D_EDGE + D_GRASS) ZIP1 <- zeroinfl(f1, dist="poisson", link = "logit", data = FAWNS) There is no correlation between my covariates. Also, I tried reducing my categorical covariate to 3 levels and still receive the same error. Can anyone suggest why I may be getting this error when I add the categorical covariate? I appreciate your time and input. Thank you, Nate Nathan Svoboda Graduate Research Assistant Carnivore Ecology Lab Mississippi State University -- View this message in context: http://r.789695.n4.nabble.com/R-Error-System-is-computationally-singular-tp4631242.html Sent from the R help mailing list archive at Nabble.com.
On May 24, 2012, at 1:57 PM, Nathan Svoboda wrote:> Greetings, > > I am trying to fit a zero-inflated Poisson model using zeroinfl() > from the > pscl library. I have 5 covariates (4 continuous, 1 categorical); the > categorical variable has 7 levels. I have had success fitting > models that > contain only the continuous covariates; however, when I add the > categorical > variable to any of the models (or if I run it by itself) I get the > following > error: > > Error in solve.default(as.matrix(fit$hessian)) : > > system is computationally singular: reciprocal condition number > 3.46934e-20 > > The code I am using is: > > library(pscl) > f1 <- formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER + D_EDGE + > D_GRASS) > ZIP1 <- zeroinfl(f1, dist="poisson", link = "logit", data = FAWNS) > > There is no correlation between my covariates. Also, I tried > reducing my > categorical covariate to 3 levels and still receive the same error. > Can > anyone suggest why I may be getting this error when I add the > categorical > covariate? >What does this show: with( FAWNS, table(LOCS, LCOVER) ) -- David Winsemius, MD West Hartford, CT
Thank you for your quick reply, When I run the code you provide I get this output: LCOVER LOCS 1 2 3 4 5 6 7 9 0 214507 79939 69803 778359 22932 32391 99630 8082 1 15 7 1 32 0 0 0 0 2 2 1 0 0 0 0 0 0 3 0 0 0 1 0 0 0 0 Nate -- View this message in context: http://r.789695.n4.nabble.com/R-Error-System-is-computationally-singular-tp4631242p4631251.html Sent from the R help mailing list archive at Nabble.com.