I have a zero inflated dataset of parasite counts (47% of zeros) and I would like to use a Zero Inflated model to analyse it.
Here is a fake and short version of the dataframe.
hostsp <- sample(LETTERS[1:4], 100, replace=TRUE)
hostdiet <- sample(letters[24:26], 100, replace=TRUE, prob=c(0.5, 0.2, 0.3) )
sl <- runif(100, min=10, max=120)
nrparas <- sample(0:9, 100, replace=TRUE, prob=c(0.47,0.25,0.15,0.05,0.03,0.02,0.01,0.01,0.005,0.005) )
DF <- data.frame(hostsp, hostdiet, sl, nrparas, stringsAsFactors=T)
Basically, each row is an host individual that belongs to an host species (hostsp) with its diet (hostdiet, nested), size (sl) and the number of parasites infecting it (nrparas).
hostsp hostdiet sl nrparas
1 A x 86.62092 0
2 A y 92.23788 0
3 C z 44.67148 2
4 D x 41.82872 1
5 C z 104.24964 0
6 D x 117.51238 2
And here is the zero inflated model:
zip1 <- zeroinfl(nrparas ~ hostsp*sl+hostdiet | hostsp*sl+hostdiet, data=DF)
summary(zip1)
But when I run the model, I get an error message and the model is not running.
Error in solve.default(as.matrix(fit$hessian)) :
system is computationally singular: reciprocal condition number = 1.03323e-36
In my original dataframe, this error disappears if I remove some variables from the ZI formula (especially host species, which is the most interesting part for me!)
Why I get this error message? How can I solve it?
Thank you very much!