[R-meta] Cannot fit model: rma.glmm with zero events

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Sat Mar 3 11:46:47 CET 2018

Hi Jon,

The error stems from lme4, which refuses (appropriately!) to fit this model when there are zero events.

Fitting the FE model does work:

res_IG_Y_frameless <- rma.glmm(measure="PLO", xi=num, ni=denom, data=df, slab=UniqueID, subset=(igns=="Y" & frame_type=='frameless'), method="FE")

But the log odds is technically -Inf here. That's pretty much what the estimate of -28.1801 indicates.

Since you have no way of estimating heterogeneity here, you could assume homogeneity, in which case you are in a situation where you have a binomial distribution with:

sum(df[df$igns=="Y" & df$frame_type=='frameless',"denom"])

trials (i.e., 304) with 0 observed events (the sum of independent binomials with the same true probability is the same as a binomial with the the total number of trials). Then a CI (computed by inverting the score test) for the true proportion can be obtained with:

prop.test(0, 304)

Or, using the rule of three (https://en.wikipedia.org/wiki/Rule_of_three_(statistics)):


is the upper bound (the lower bound is obviously 0).


>-----Original Message-----
>From: jonathan.c.lau at gmail.com [mailto:jonathan.c.lau at gmail.com] On
>Behalf Of Jonathan C. Lau
>Sent: Friday, 02 March, 2018 21:20
>To: r-sig-meta-analysis at r-project.org
>Cc: Viechtbauer Wolfgang (SP)
>Subject: Cannot fit model: rma.glmm with zero events
>ATTACHMENT(S) REMOVED: test.csv | glmm_problem.R
>Hi there,
>I am performing a meta-analysis of proportions where the event rates are
>logit-transformed (PLO) prior to random effects modeling. In the main
>analysis, where events are not as sparse, I have been able to run
>rma.glmm without any problems. However, when performing the subgroup
>analysis, I have some situations where there are zero events in one of
>the groups, resulting in the following error: "Error in rma.glmm(measure
>= "PLO", xi = num, ni = denom, data = df, slab = UniqueID,  :  Cannot fit
>ML model." See below for the log. I've also attached a basic example with
>.csv and .R code.
>Can you please advise?
>Happy to provide more details if necessary.
>> rm(list=ls())
>> # meta-analysis code example for metafor
>> library(metafor)
>> library(lme4)
>> # citing metafor package
>> citation(package='metafor')
>To cite the metafor package in publications, please use:
>  Viechtbauer, W. (2010). Conducting meta-analyses in R with the
>  metafor package. Journal of Statistical Software, 36(3), 1-48.
>  URL: http://www.jstatsoft.org/v36/i03/
>A BibTeX entry for LaTeX users is
>  @Article{,
>    title = {Conducting meta-analyses in {R} with the {metafor} package},
>    author = {Wolfgang Viechtbauer},
>    journal = {Journal of Statistical Software},
>    year = {2010},
>    volume = {36},
>    number = {3},
>    pages = {1--48},
>    url = {http://www.jstatsoft.org/v36/i03/},
>  }
>> packageVersion('metafor') # to know current version number
>[1] ‘1.9.9’
>> df <- read.table('test.csv', header = TRUE, sep = ',')
>> res_IG_Y <- rma.glmm(measure="PLO", xi=num, ni=denom, data=df,
>> ### fit random-effects model in the two subgroups
>> res_IG_Y_frameless <- rma.glmm(measure="PLO", xi=num, ni=denom,
>data=df, slab=UniqueID, subset=(igns=="Y" & frame_type=='frameless')) #
>Error in rma.glmm(measure = "PLO", xi = num, ni = denom, data = df, slab
>= UniqueID,  :
>  Cannot fit ML model.
>> res_IG_Y_frame <- rma.glmm(measure="PLO", xi=num, ni=denom, data=df,
>slab=UniqueID, subset=(igns=="Y" & frame_type=="frame"))

More information about the R-sig-meta-analysis mailing list