[R-meta] : Question: Metafor R package - rma and rma.mv function

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Wed Jul 25 21:30:12 CEST 2018

Dear Simona,

I agree with Michael, those weights seem appropriate given those variances.

But you should read:


and ideally the entire page. You are only adding random effects for studies, but not estimates within studies. So you really should be using:

dat1$est_id <- 1:nrow(dat1)
res <- rma.mv(yi, vi, data=dat1,random = ~ 1 | study_id / est_id, verbose=T)

(for this toy example, the estimate level variance component is 0, so it doesn't matter, but generally it might).

As for convergence: If the optimizer does not converge, you will get an error. For example:

res <- rma.mv(yi, vi, data=dat1,random = ~ 1 | study_id / est_id, verbose=T, control=list(iter.max=10))


Error in rma.mv(yi, vi, data = dat1, random = ~1 | study_id/est_id, verbose = T,  : 
  Optimizer (nlminb) did not achieve convergence (convergence = 1).

If you do not get convergence, you could try adjusting the optimizer settings or switching to a different optimizer. See help(rma.mv) and esp. the 'Note' section towards the bottom.


-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Michael Dewey
Sent: Wednesday, 25 July, 2018 15:06
To: Simona Frederiksen; r-sig-meta-analysis using r-project.org
Subject: Re: [R-meta] : Question: Metafor R package - rma and rma.mv function

Simona Frederiksen <simona.frederiksen using hotmail.com> wrote :

Dear Simona

Given the calculated variances (vi) the weights seem quite OK to me.

Would the question underlying the convergence issue be better answered by using profile.rma.mv()?

Please set your mailer to post in plain text not HTML as your post got mangled which made running your example rather tricky.


> Hi,
> I have some question sthat I would like to get posted regarding the metafor R
> package and the rma and rma.mv function. It goes like this:
> Hi,
> I am at the moment working in the R package 'metafor' in order to perform a
> meta-analysis which I carry out in collaboration with the Danish Headache
> Center. I just figured that I have to use the rma.mv function since I have
> several effect sizes per study (for two studies).
> I have following questions that I hope you can help me answer:
>   1.  When I calculate the weights for each study, the studies that have more
> effect sizes receive a really high weight compared to the other studies with
> just one effect size. So it seems that these studies primarily are used to
> calculate the overall effect size even though N seems to be quite small?
>   1.  How can I see convergence when I use the rma.mv function? When using the
> rma function, it turns up when adding verbose = T. And if it does not converge,
> what would be ideal to do?
> Here is an example:
> library("metafor")
> study_id 

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