rregressionlme4poisson

use zeroinfl with lmer in r


I'm trying to merge a zeroinfl Poisson regression with a lmer model. How can I do that?

cro<-zeroinfl(carbapenem~time+COVID-19+time*COVID-19+month+(time|ORGANISM),data=all_mall)

This is the error it gives:

Error in X1 | ORGANISM : 
  operations are possible only for numeric, logical or complex types

Solution

  • Probably the easiest way would be to use a Bayesian approach with the brms package. For example,

    brm(carbapenem~time+`COVID-19`+time*`COVID-19`+month+(time|ORGANISM),
        data = all_mall, family = zero_inflated_poisson())
    

    Note that to treat COVID-19 as a variable, you should enclose it in back-ticks.