[R] Using Metafor package: how to backtransform model coefficients when Freeman Tukey double arcine transformation is used
Viechtbauer Wolfgang (STAT)
wolfgang.viechtbauer at maastrichtuniversity.nl
Thu Dec 16 10:22:27 CET 2010
Dear Patricia,
I was recently asked the exact same question, so the answer is yes, but it takes a little bit of extra work and the newest version of the metafor package (version 1.5-0, which was submitted to CRAN yesterday and which should hopefully be ready for download in a few days).
I'll briefly describe the additional difficulty that comes with this transformation and the solution. The inverse of the Freeman Tukey double arcine transformation is described in: Miller, J. J. (1978). The inverse of the Freeman-Tukey double arcsine transformation. American Statistician, 32(4), 138. It's a bit messy, but it works just fine:
> xi <- c( 0, 1, 12, 38, 40)
> ni <- c(10, 10, 20, 40, 40)
>
> dat <- cbind(xi, ni, pi = xi/ni)
>
> dat <- escalc(measure="PFT", xi=xi, ni=ni, data=dat, append=TRUE, add=0)
> dat
xi ni pi yi vi
1 0 10 0.00 0.1531387 0.02380952
2 1 10 0.10 0.3733940 0.02380952
3 12 20 0.60 0.8813361 0.01219512
4 38 40 0.95 1.3224900 0.00617284
5 40 40 1.00 1.4923885 0.00617284
>
> ### check back-transformation for individual outcomes
> transf.ipft(dat$yi, dat$ni)
[1] 0.00 0.10 0.60 0.95 1.00
Okay, so far so good. Note that in order to back-transform a Freeman Tukey transformed value, we not only need the transformed value itself (dat$yi), but also the corresponding n (dat$ni). This is why the transf.ipft() function takes two arguments.
Now we fit a fixed- (or random-) effects model to these data and then want to back-transform the estimated average, so we get an estimate in the original units (i.e., as a proportion). But what n should we use? After all, the n that applies to the estimated average is not the same as the n for any individual transformed value. Miller (1978) makes a suggestion here and proposes to use the harmonic mean of the n's. So, let's use that:
> res <- rma(yi, vi, method="FE", data=dat)
> res
Fixed-Effects Model (k = 5)
Test for Heterogeneity:
Q(df = 4) = 96.4471, p-val < .0001
Model Results:
estimate se zval pval ci.lb ci.ub
1.1233 0.0452 24.8643 <.0001 1.0347 1.2118 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> ### back-transformation of the estimated average using the harmonic mean of the n's
> pred <- predict(res, transf=transf.ipft.hm, targs=list(ni=ni))
> pred
pred se ci.lb ci.ub
0.8306 NA 0.7529 0.8977
In order to use the transf.ipft.hm() function, you need to supply a list with the individual n's via the targs argument, so that the harmonic mean can be computed.
Okay, so that works as well. But if you now want to draw a forest plot, things get messy. For example, neither of these plots:
> ### wrong transformation for the individual studies
> forest(res, digits=3, atransf=transf.ipft.hm, targs=list(ni=ni), refline=NA, xlim=c(-1.5,3.5))
> forest(res, digits=3, transf=transf.ipft.hm, targs=list(ni=ni), refline=NA, xlim=c(-0.5,2), alim=c(0,1))
will work, since the individual values will also be back-transformed using the harmonic mean of the n's, which now yields the wrong back-transformed values.
So, here is what you need to do:
> ### calculate back-transformed CI bounds manually
> ci.lb <- transf.ipft(dat$yi - 1.96*sqrt(dat$vi), dat$ni)
> ci.ub <- transf.ipft(dat$yi + 1.96*sqrt(dat$vi), dat$ni)
>
> ### create forest plot with CI bounds supplied and then add the model estimate using addpoly()
> forest(dat$pi, ci.lb=ci.lb, ci.ub=ci.ub, ylim=c(-0.5,8), refline=NA, xlim=c(-.5,1.8), alim=c(0,1), digits=3, xlab="Proportion")
> addpoly(pred$pred, ci.lb=pred$ci.lb, ci.ub=pred$ci.ub, row=0, digits=3)
> abline(h=0.5)
And this plot has the correct back-transformed values for the individual proportions and the estimated average.
Again, it will take a few days before the new version of the metafor package is available via CRAN. Then that will allow you to do this.
Best,
--
Wolfgang Viechtbauer
Department of Psychiatry and Neuropsychology
School for Mental Health and Neuroscience
Maastricht University, P.O. Box 616
6200 MD Maastricht, The Netherlands
Tel: +31 (43) 368-5248
Fax: +31 (43) 368-8689
Web: http://www.wvbauer.com
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Bruijning-Verhagen, P.C.J.L.
> Sent: Wednesday, December 15, 2010 17:22
> To: r-help at r-project.org
> Subject: [R] Using Metafor package: how to backtransform model
> coefficients when Freeman Tukey double arcine transformation is used
>
> Hello,
>
> I am performing a meta-analysis using the metafor package. My data are
> proportions and I used the Freeman Tukey double arcine (FT)
> transformation to fit the random effects model. Now I want to create a
> forest plot with my estimates backtransformed to the original scale of
> proportions. Can this be done?
>
> Regards,
> Patricia
More information about the R-help
mailing list