1

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!

Tweety
  • 11
  • 2
  • Is it possible that you have a strong collinearity among host specie and something else? The error says that the system is singular and this could explain why removal of host specie variable remove the error. Is this of any help? https://stackoverflow.com/questions/44134711/zeroinfl-system-is-computationally-singular-whereas-no-correlation-in-predicto – Ale Sep 21 '18 at 09:38
  • Thank you for the link. Indeed, I already ruled out other variables that are collinear (eg weight and length of hosts). But of course hostsp is nested within hostdiet: each diet "contains" few host species (and each host species has only one diet). This can be a problem? How do I code that it is nested? – Tweety Sep 21 '18 at 10:04
  • I don't know, I suppose you create a dummy variable that summarize hostsp&hostdiet if the combinations are not too many. If not you may need to remove hostdiet – Ale Sep 21 '18 at 12:24

0 Answers0