[R-meta] metafor question - forest plot with subset of cumul results

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Wed Nov 21 11:48:05 CET 2018


The code below creates two forest plots, showing the results from cumul() (using sample size for the ordering) for the first 10% and last 10% of the studies.

###############

library(metafor)

dat <- get(data(dat.mcdaniel1994, package="metafor"))
dat <- escalc(measure="ZCOR", ri=ri, ni=ni, data=dat)

res <- rma(yi, vi, data=dat, subset=head(order(dat$ni), round(.10 * nrow(dat))))
sav <- cumul(res)

par(mfrow=c(2,1))

forest(sav, at=seq(-1, 4, by=1), cex=.8, xlim=c(-3,6))

res <- rma(yi, vi, data=dat, subset=order(dat$ni))
sav <- cumul(res)

forest.default(sav$estimate, sei=sav$se, subset=seq(nrow(dat) - round(.10 * nrow(dat)) + 1, nrow(dat)), slab=paste("+ Study", sav$slab), psize=1, at=seq(-1, 4, by=1), cex=.8, xlim=c(-3,6))

###############

Not sure if this is what Jose wanted.

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-
>project.org] On Behalf Of Jose Antonio Espinoza Mogollon
>Sent: Tuesday, 20 November, 2018 20:49
>To: Michael Dewey; r-sig-meta-analysis using r-project.org
>Subject: Re: [R-meta] metafor question - forest plot with subset of cumul
>results
>
>Hello Michael,
>
>Thank you for the link! I'll definitely fall back on that if I can't
>figure this out in metafor
>
>--
>Jose A. Espinoza, M.Sc.
>Ph.D. Candidate, Industrial/Organizational Psychology
>Western University
>Social Science Centre, Rm. 8424A
>www.iopsychwestern.com
>
>On November 19, 2018 at 8:37:30 AM, Michael Dewey
>(lists using dewey.myzen.co.uk<mailto:lists using dewey.myzen.co.uk>) wrote:
>
>Dear Jose
>
>Not sure how you do this in metafor but Guido outlines here
>https://stat.ethz.ch/pipermail/r-sig-meta-analysis/2018-
>August/000981.html
>how to do it in the meta package so you have a fall back position.
>
>Michael
>
>On 18/11/2018 20:26, Jose Antonio Espinoza Mogollon wrote:
>> Hello all,
>>
>> I've been trying to learn how to use the metafor package using the
>dat.mcdaniel1994 dataset included in the package.
>>
>> This data set has 160 studies, so a forest plot of results using the
>cumul function is really hard to interpret.
>>
>> Is it possible to create a forest plot that only displays a subset of
>the results from the cumul function (e.g., rows 1:10)?
>>
>> I'd like to eventually create separate plots that "zoom in" on the top
>10% and bottom 10% (ordered by N) of the cumulative results.
>>
>> Thank you for any help,
>>
>>
>> --
>> Jose A. Espinoza, M.Sc.
>> Ph.D. Candidate, Industrial/Organizational Psychology
>> Western University
>> Social Science Centre, Rm. 8424A
>> www.iopsychwestern.com



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