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

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Sat Mar 3 17:23:45 CET 2018


Yes! It's exactly for these types of special cases that addpoly() has the 'ci.lb' and 'ci.ub' arguments.

Best,
Wolfgang

>-----Original Message-----
>From: Jonathan C. Lau [mailto:jlau287 at uwo.ca]
>Sent: Saturday, 03 March, 2018 16:36
>To: Viechtbauer Wolfgang (SP)
>Cc: r-sig-meta-analysis at r-project.org
>Subject: Re: Cannot fit model: rma.glmm with zero events
>
>Hi Wolfgang,
>
>Thanks for the very clear explanation.
>
>I've integrated your suggestions into my script. For forest plot
>visualization, everything remains the same except for the addpoly() call
>to the zero event subgroup:
>
>pt <- prop.test(0, 304)
>addpoly(x=pt$estimate, ci.lb=pt$conf.int[1], ci.ub=pt$conf.int[2],
>cex=0.75, mlab="FE Model for Subgroup (Zero Events)", digits=3)
>
>rather than my typical RE Model addpoly line:
>addpoly(res_IG_Y_modern_N, cex=0.75, transf=transf.ilogit, mlab="RE Model
>for Subgroup", digits=3)
>
>-jon
>
>On Sat, Mar 3, 2018 at 5:46 AM Viechtbauer Wolfgang (SP)
><wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
>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)):
>
>3/304
>
>is the upper bound (the lower bound is obviously 0).
>
>Best,
>Wolfgang
>
>>-----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.
>>
>>Thanks,
>>jon
>>
>>--
>>
>>> 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,
>>slab=UniqueID)
>>>
>>> ### 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')) #
>>zero
>>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