在 r 中将 zeroinfl 与 lmer 结合使用

use zeroinfl with lmer in r

我正在尝试将 zeroinfl 泊松与 lmer 模型合并,我该怎么做?

cro<-zeroinfl(carbapenem~time+COVID-19+time*COVID-19+month+(time|ORGANISM),data=all_mall)
Error in X1 | ORGANISM : 
  operations are possible only for numeric, logical or complex types

可能最简单的方法是使用带有 brms 包的贝叶斯方法。例如,

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

请注意,要将 COVID-19 视为变量,应将其括在 back-ticks 中。