Dear community, I am having trouble understanding the way 0-inflation is taken into account in mixed-effects beta regressions with the glmmTMB package. I have a dataset which consists in readouts of bacterial cells which express or not a certain behaviour according to the state of their parent cell and over time. The response variable is expressed as a number of cells expressing the behaviour over the total number of cells. There are 0s in one parental state, but not the other. I fitted : M1 <- glmmTMB(propCFU~ parent_state * TIME + (1|SAMPLE), data=prop_daughters, ziformula= ~1, family=beta_family(link = "logit")) Which gives : summary(M1) ?Family: beta? ( logit ) Formula:????????? propCFUdaught ~ parent_treat * TIME + (1 | SAMPLE) Zero inflation:???????????????? ~1 Data: prop_daughters ????? AIC?????? BIC??? logLik -2*log(L)? df.resid ?? -672.9??? -640.7???? 349.4??? -698.9??????? 75 Random effects: Conditional model: ?Groups Name??????? Variance? Std.Dev. ?SAMPLE (Intercept) 4.322e-09 6.574e-05 Number of obs: 88, groups:? SAMPLE, 30 Dispersion parameter for beta family ():? 327 Conditional model: ????????????????????????????? Estimate Std. Error z value Pr(>|z|) (Intercept)?????????????????? -7.67870??? 0.73063 -10.510 <2e-16 *** parent_treatstationary???????? 1.22248??? 0.75556?? 1.618 0.106 TIME20???????????????????????? 0.06966??? 0.80420?? 0.087 0.931 TIME40???????????????????????? 0.70438??? 0.78492?? 0.897 0.370 TIME60???????????????????????? 1.00432??? 0.81196?? 1.237 0.216 TIME80???????????????????????? 0.91809??? 0.81363?? 1.128 0.259 parent_treatstationary:TIME20 -0.16829??? 0.90534? -0.186 0.853 parent_treatstationary:TIME40 -1.34558??? 0.94120? -1.430 0.153 parent_treatstationary:TIME60 -1.43812??? 0.91828? -1.566 0.117 parent_treatstationary:TIME80 -0.50110??? 0.98536? -0.509 0.611 --- Signif. codes:? 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 Zero-inflation model: ??????????? Estimate Std. Error z value Pr(>|z|) (Intercept)? -0.8150???? 0.2312? -3.526 0.000422 *** ... and a pretty terrible fit, because of the 0s I suppose : plot(simulateResiduals(M1)) ... which makes me think that the 0s might not be properly taken into account. Is there anything I am doing wrong ? I would take any advice on how to improve this. Thank you ! (for taking the time to read it so close to holiday time...) Caroline
glmmTMB with beta family and 0-inflation
2 messages · Caroline Zanchi, Ben Bolker
1 day later
Hi Caroline, comments below/inline.
On 12/19/25 07:37, Caroline Zanchi wrote:
Dear community, I am having trouble understanding the way 0-inflation is taken into account in mixed-effects beta regressions with the glmmTMB package. I have a dataset which consists in readouts of bacterial cells which express or not a certain behaviour according to the state of their parent cell and over time. The response variable is expressed as a number of cells expressing the behaviour over the total number of cells. There are 0s in one parental state, but not the other.
In principle, if you know the original total number of cells, you
could use a zero-inflated beta-binomial model instead of a hurdle-beta.
This may not matter as much if the total number of cells is very large
(in which case the beta-binomial will approximate a beta pretty well
anyway). (You might not even need the zero-inflation, if the
conditional distribution is such that the proportion of non-CFU
daughters is well described by the zeros in the beta-binomial distribution).
You could also try family = "ordbeta".
>
I fitted : \\ M1 <- glmmTMB(propCFU~ parent_state * TIME + (1|SAMPLE), data=prop_daughters, ziformula= ~1, family=beta_family(link = "logit")) Which gives : summary(M1) ?Family: beta? ( logit ) Formula:????????? propCFUdaught ~ parent_treat * TIME + (1 | SAMPLE) Zero inflation:???????????????? ~1 Data: prop_daughters ????? AIC?????? BIC??? logLik -2*log(L)? df.resid ?? -672.9??? -640.7???? 349.4??? -698.9??????? 75 Random effects: Conditional model: ?Groups Name??????? Variance? Std.Dev. ?SAMPLE (Intercept) 4.322e-09 6.574e-05
Your fit is singular. (There's little enough among-sample variance that it is estimated as zero -- all the variance can be explained by the variability in the conditional distribution.) You can see the GLMM FAQ for more discussion of singular fits.
Number of obs: 88, groups:? SAMPLE, 30 Dispersion parameter for beta family ():? 327
This corresponds to a very sharp (low-variance) conditional distribution. From ?beta_binomial: V=mu*(1-mu)/(phi+1)
Conditional model: ????????????????????????????? Estimate Std. Error z value Pr(>|z|) (Intercept)?????????????????? -7.67870??? 0.73063 -10.510 <2e-16 *** parent_treatstationary???????? 1.22248??? 0.75556?? 1.618 0.106 TIME20???????????????????????? 0.06966??? 0.80420?? 0.087 0.931 TIME40???????????????????????? 0.70438??? 0.78492?? 0.897 0.370 TIME60???????????????????????? 1.00432??? 0.81196?? 1.237 0.216 TIME80???????????????????????? 0.91809??? 0.81363?? 1.128 0.259 parent_treatstationary:TIME20 -0.16829??? 0.90534? -0.186 0.853 parent_treatstationary:TIME40 -1.34558??? 0.94120? -1.430 0.153 parent_treatstationary:TIME60 -1.43812??? 0.91828? -1.566 0.117 parent_treatstationary:TIME80 -0.50110??? 0.98536? -0.509 0.611 --- Signif. codes:? 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 Zero-inflation model: ??????????? Estimate Std. Error z value Pr(>|z|) (Intercept)? -0.8150???? 0.2312? -3.526 0.000422 ***
Nothing here looks especially strange.>
... and a pretty terrible fit, because of the 0s I suppose : plot(simulateResiduals(M1))
We can't see the simulated residuals plot (the mailing list doesn't accept attachments), so we don't know what's wrong. Nothing looks obviously wrong with your model. You might also try performance::check_model() for a different set of diagnostics.
... which makes me think that the 0s might not be properly taken into account. Is there anything I am doing wrong ? I would take any advice on how to improve this. Thank you ! (for taking the time to read it so close to holiday time...) Caroline
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Dr. Benjamin Bolker Professor, Mathematics & Statistics and Biology, McMaster University Associate chair (graduate), Mathematics & Statistics Director, School of Computational Science and Engineering * E-mail is sent at my convenience; I don't expect replies outside of working hours.