# [R-meta] predicted intervals in metafor

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Wed Jun 6 11:02:54 CEST 2018

```Dear Rav,

The default is REML.

Checking whether the sampling distribution of the outcome measure is normal is not something that you can do in your observed data. Outcome measures typically used in meta-analysis all have, at least asymptotically, a normal sampling distribution. So, as long as your sample sizes are not too small, this is not something you typically have to worry about.

As for the distribution of the true effects: In principle, this can be checked in the actual data, but this is difficult to do. One possible approach is to examine the distribution of the predicted random effects, which you can get with the ranef() function.

Best,
Wolfgang

-----Original Message-----
From: Raynaud Armstrong [mailto:raynaud.armstrong using gmail.com]
Sent: Tuesday, 05 June, 2018 19:24
To: r-sig-meta-analysis using r-project.org; Viechtbauer, Wolfgang (SP)
Subject: Fwd: [R-meta] predicted intervals in metafor

Dear Wolfgang,
Sorry for not being clear. I was just wanting to know if I needed to check normality of my effect sizes collectively - which you have already answered. I would also like to know the default method in random effects meta-analysis in metafor - is it REML or DL?
How can we test the assumption that the sampling distributions are normal and that the underlying true effects are normal?

Thanks
RAv

On Tue, Jun 5, 2018 at 12:48 PM, Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
Dear Raynaud,

Not sure what you mean by 'default method'. Do you mean the method for computing the prediction interval? By default, it is:

mu-hat +/- 1.96 sqrt(SE(mu-hat)^2 + tau^2)

where 'mu-hat' is the estimate of mu, SE(mu-hat) is the corresponding standard error, and tau^2 is the estimated amount of heterogeneity (between-study variance).

When using the Knapp & Hartung method (argument: test="knha"), then instead of 1.96 (or rather qnorm(.975) to be exact), the equation uses the 97.5th percentile from a t-distribution with k-1 df (where k is the number of studies).

As for the distribution of the effect sizes: The RE model does not assume that the collection of observed effects is normally distributed. It assumes that the sampling distributions are normal and that the underlying true effects are normal. However, that does not imply that the (marginal) distribution of the observed effects is normally distributed.

Best,
Wolfgang

-----Original Message-----
From: Raynaud Armstrong [mailto:raynaud.armstrong using gmail.com]
Sent: Tuesday, 05 June, 2018 17:57
To: r-sig-meta-analysis using r-project.org; Viechtbauer, Wolfgang (SP)
Subject: Fwd: [R-meta] predicted intervals in metafor

Hi everyone!
I would like to know what is the default method in random effects meta-analysis in metafor.
My effect size (cohen's d) is not normally distributed. Does that matter?
Thanks
RAv
---------- Forwarded message ----------
From: Raynaud Armstrong <raynaud.armstrong using gmail.com>
Date: Sat, Dec 16, 2017 at 6:34 AM
Subject: Re: [R-meta] predicted intervals in metafor
To: "Viechtbauer Wolfgang (SP)" <wolfgang.viechtbauer using maastrichtuniversity.nl>

Perfect - it worked!
Thanks

On Fri, Dec 15, 2017 at 3:38 AM, Viechtbauer Wolfgang (SP) <wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
Dear Raynaud,

Once you have the SMD values and corresponding sampling variances, the code is the same. Here is an example:

library(metafor)

dat <- get(data(dat.normand1999))

### calculate SMDs and corresponding sampling variances
dat <- escalc(measure="SMD", m1i=m1i, sd1i=sd1i, n1i=n1i, m2i=m2i, sd2i=sd2i, n2i=n2i, data=dat)
dat

### meta-analysis of SMD values using a random-effects model
res <- rma(yi, vi, data=dat)
res

### get prediction/credibility interval
predict(res)

If you have calculated the SMD values and variances yourself, you can skip the escalc() step and go straight to rma(). Adjust variables names as needed.

Best,
Wolfgang

-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Raynaud Armstrong
Sent: Friday, 15 December, 2017 1:37
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] predicted intervals in metafor

Hi there,
I would like to calculate predicted intervals in addition to my pooled
estimate and CIs as I have plenty of between-study variation in my
meta-analysis. I am using metafor package and my summary estimated is an
effect size (SMD) and not odds ratios. The examples I have come across
mainly focus on odds ratios and I wonder what to do for SMDs.
I would appreciate if someone could suggest what function to use.

Thank you,
Raynaud
```