[R] 'metafor' - standardized mean difference in pre-post design studies

Antonello Preti antoviral at gmail.com
Mon Apr 13 21:25:56 CEST 2015


Hi, I have a quesite on meta-analysis with 'metafor'.
I would like to calculate the standardized mean difference (SMD), as
Hedges' g, in pre-post design studies.
I have data on baseline (sample size, mean and SD in both the experimental
and the control group) and at end of treatment (same as before).
The 'metafor' site report a calculation based on Morris (2008).
However, I would like to calculate the SMD as in Comprehensive
Meta-analysis according to Borenstein:

d = (mean.pre - mean.post) / SD_within

SD_within = SD.diff / square root (2(1-r)

r = correlation between pairs of observation (often it is not reported, and
suggestion is to use r = 0.70)

The variance of d (Vd) is calculated as (1/n + d^2/2n)2(1-r), where n =
number of pairs

To derive Hedges' g from d, the correction 'J' is used:

J = 1 - (3/4df - 1), where df = degrees of freedom, which in two
independent groups is n1+n2-2

Essentially, J = 1 - (3/4*((n1+n2)-2) - 1)

Ultimately, g = J x d, and variance of g (Vg) = J^2 x Vd


I had some hint by Wolfgang Viechtbauer, but I'm stucked on here
(essentially, because my poor programming abilities)
I was stuck on applying the Viechtbauer's hint to my dataset.
Probably I'm doing something wrong. However, what I get it is not what I
found with Comprehensive Meta-Analysis.
In CMA I've found g = -0.49 (95%CI: -0.64 to -0.33).

Moreover, I do not know how to apply the J correction for calculating the
Hedges'g.
My request is: can anyone check the codes?
Can anyone help me in adding the J correction?
What should I multiply for J?
Should I use the final yi and vi as measures of d and Variance of d?


Thank you in advance,
Antonello Preti


This is my dataset (with imputed r = 0.70, put in the 'ri' variable):

##### the data

dat <- structure(list(study = structure(c(11L, 8L, 7L, 12L, 13L, 4L,
5L, 1L, 10L, 3L, 6L, 9L, 2L), .Label = c("Study A, 2012",
"Study B, 2013", "Study C, 2013", "Study D, 2010",
"Study E, 2012", "Study F, 2013", "Study G, 2006",
"Study H, 2005", "Study I, 2013", "Study L, 2012",
"Study M, 2003", "Study N, 2007", "Study P, 2007"
), class = "factor"), c_pre_mean = c(4.9, 15.18, 19.01, 5.1,
16.5, 27.35, 18.1, 2.4, 14.23, 0.08, 21.26, 21.5, 21.73), c_pre_sd = c(2.6,
2.21, 7.1, 1.5, 7.2, 13.92, 5.4, 0.13, 4.89, 0.94, 7.65, 5.22,
8.43), c_post_mean = c(6.1, 13.98, 18.5, 4.53, 15.9, 23, 16.9,
2.2, 16.58, -0.02, 16, 16.84, 23.54), c_post_sd = c(2.06, 3.24,
7, 2.06, 6.8, 12.06, 3.8, 0.13, 6.35, 0.88, 4.69, 4.64, 6.74),
    c_sample = c(14, 13, 19, 15, 34, 20, 24, 35, 31, 26, 49,
    21, 22), e_pre_mean = c(4.6, 13.81, 19.9, 5.3, 18.7, 22.71,
    19.2, 2.7, 15.97, -0.22, 20.9, 20.43, 21.94), e_pre_sd = c(2.1,
    6.64, 8.1, 2.9, 7.3, 7.82, 4.1, 0.13, 6.73, 0.93, 5.18, 4.87,
    7.02), e_post_mean = c(4.64, 15.86, 18.1, 4.33, 17.2, 24.89,
    17.6, 2.8, 13.6, 0.06, 17.41, 16.05, 19.29), e_post_sd = c(2.34,
    7.76, 7.8, 2.26, 7.4, 11.89, 3.7, 0.13, 5.79, 1.12, 5.16,
    4.17, 6.58), e_sample = c(14, 18, 16, 16, 33, 28, 29, 36,
    38, 27, 43, 25, 17), ri = c(.70,
.70,.70,.70,.70,.70,.70,.70,.70,.70,.70,.70,.70)), .Names = c("study",
"c_pre_mean", "c_pre_sd",
"c_post_mean", "c_post_sd", "c_sample", "e_pre_mean", "e_pre_sd",
"e_post_mean", "e_post_sd", "e_sample", "ri"), class = "data.frame",
row.names = c(NA,
-13L))


### check the data

dim(dat)
head(dat)
str(dat)

### to make easy the operations (I know it should'nt be done)

attach(dat)


### call the library

library('metafor')

### The hint by Viechtbauer is that CMA computes the d value for a pre-post
design in a slightly different way than metafor. CMA computes:

### d = (m_1 - m_2) / (SD_diff / sqrt(2*(1-r)))

### To do this, I should calculate something like this (first the control
group):

sd1i= c_pre_sd
sd2i = c_post_sd
ni = c_sample

dat$sdi_c <- with(dat, sqrt((sd1i^2 + sd2i^2 -
2*ri*sd1i*sd2i))/sqrt(2*(1-ri)))

### Then apply the usual calculation with escalc:

datC <- escalc(measure="SMCR", m1i=c_pre_mean, m2i=c_post_mean, sd1i=sdi_c,
ni=ni, ri=ri, data=dat)
summary(datC)


#### The same on the experimental group

sd1i= e_pre_sd
sd2i = e_post_sd
ni = e_sample


dat$sdi_e <- with(dat, sqrt((sd1i^2 + sd2i^2 -
2*ri*sd1i*sd2i))/sqrt(2*(1-ri)))

datE <- escalc(measure="SMCR", m1i=e_pre_mean, m2i=e_post_mean, sd1i=sdi_e,
ni=ni, ri=ri, data=dat)
summary(datE)


#### Computing the Difference in the Standardized Mean Change

datFin <- data.frame(yi = datE$yi - datC$yi, vi = datE$vi + datC$vi)
round(datFin, 2)



###############################################
#
# fixed-effects model
#
###############################################

model.FE <- rma(yi, vi, data=datFin, method="FE", digits=2)

summary(model.FE)

# plot globale

plot(model.FE, slab=paste(study))


###
###

	[[alternative HTML version deleted]]



More information about the R-help mailing list