Hi community!
I am working with zero-inflated negative binomial regression and I am having an error message when trying to apply the regression. The error message is: << Error in solve.default(as.matrix(fit$hessian)) :
system is computationally singular: reciprocal condition number = 6.75794e-34 >>
I think it is related to matrix size or that it is not invertible, but I do not know how to solve it... I would like to attach the real code but it is so big to create a reprex (about 50000 rows), however, I have created an example one:
library("pscl")
#> Classes and Methods for R developed in the
#> Political Science Computational Laboratory
#> Department of Political Science
#> Stanford University
#> Simon Jackman
#> hurdle and zeroinfl functions by Achim Zeileis
analysis_example<-data.frame(
CM = c(0, 0, 0, 0, 2, 4, 1, 2, 2, 12, 6, 2),
Heavy = c(2.08333333333333, 5.53191489361702, 2.99625468164794,
2.75862068965517, 10.2040816326531, 0.390625,
0.613496932515337, 7.14285714285714, 1.63934426229508, 0.609756097560976,
1.06382978723404, 1.16959064327485)
)
CM.zinb <- zeroinfl(CM ~ Heavy | Heavy, data = analysis_example, link = "logit", dist = "negbin", trace = TRUE, EM = FALSE)
#> Zero-inflated Count Model
#> count model: negbin with log link
#> zero-inflation model: binomial with logit link
#> dependent variable:
#> 0 1 2 3 4 5 6 7 8 9 10 11 12
#> 4 1 4 0 1 0 1 0 0 0 0 0 1
#> generating starting values...done
#> calling optim() for ML estimation:
#> initial value 26.057212
#> iter 10 value 24.632059
#> final value 24.631828
#> converged
However this reprex is not representative as it has converged...real one not: << Zero-inflated Count Model
count model: negbin with log link zero-inflation model: binomial with logit link dependent variable:
0 1 2 3 4 5 6 7 8 9 10 11 12
41485 113 56 8 12 1 1 1 0 0 0 0 1
generating starting values...done
calling optim() for ML estimation:
initial value 2591.569217
iter 10 value 1657.661886
iter 20 value 1439.561545
final value 1439.397026
converged
Error in solve.default(as.matrix(fit$hessian)) :
system is computationally singular: reciprocal condition number = 6.75794e-34>>
Thanks in advance for your help