0
$\begingroup$

I am planning to perform a zero-inflated negative binomial regression for colony forming units (CFUs) of bacteria with a drug treatment, accounting for variability in the intercept among experiments. I decided said approach, since there are some drugs in which I obtain a fair ammount of zeros. For that, I plan to use the glmmTMB package.

I was just wondering that, in order to model both the zero-inflated and the counts components of the model with the random effect, should I add the random effect on both formulas? e.g.

glmmTMB(CFU~Treatment+(1|Experiment),ziformula=~Treatment+(1|Experiment), family=nbinom2)

Thank you in advance.

$\endgroup$
3
  • 2
    $\begingroup$ I don't know off the top of my head if glmmTMB handles random effects in the ziformula. If it does, and you as the scientist think there's an appropriate theoretical justification for putting a random effect in the ziformula, then try it! Just keep in mind that it can be difficult to estimate multiple sets of random effects, and it may be difficult to actually get the model to fit when it's complex esp. if you have a small dataset. Keep an eye out for shenanigans and sense in the model results. $\endgroup$
    – Alex J
    Feb 2 at 23:34
  • 2
    $\begingroup$ @AlexJ, can you please post this as an answer? I answered the OP's question about whether ziformula can take a random effect here (hint: it does, and it's right there in the documentation ...) $\endgroup$
    – Ben Bolker
    Feb 4 at 16:09
  • $\begingroup$ How many observations total, how many levels of the Experiment variable? $\endgroup$
    – Ben Bolker
    Feb 4 at 16:10

1 Answer 1

2
$\begingroup$

It does - see https://stat.ethz.ch/pipermail/r-sig-mixed-models/2023q1/030345.html (thanks Ben).

If you as the scientist think there's an appropriate theoretical justification for putting a random effect in the ziformula, then try it! Just keep in mind that it can be difficult to estimate multiple sets of random effects, and it may be difficult to actually get the model to fit when it's complex esp. if you have a small dataset. Keep an eye out for shenanigans and sense in the model results

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.