[R] Problem with forest plot in 'meta' after update and byvar command
Michael Dewey
||@t@ @end|ng |rom dewey@myzen@co@uk
Fri Mar 22 15:35:19 CET 2019
Dear Antonello
There is a mailing list dedicated to meta-analysis and R. People from
the team behind the package you mention do post there.
https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis//
Remember to register first please.
Michael
On 21/03/2019 22:04, Antonello Preti wrote:
> Dear all, I have a problem with the package ‘meta’.
> I have 15 studies in a meta-analysis, belonging to two groups (a different
> control was used depending on the study).
> After the general estimation of the effect of the experimental treatment, I
> want to evaluate the effect by type of control. So I used the ‘update’
> function with the ‘byvar’ command.
>
> I want the sample size of the experimental group and the control group to
> be printed in the forest plot. So I added the sample size to the result of
> the subgroup analysis.
>
> Then I have arranged the forest plot to have the sample size to be printed
> before the effect size of each study, by grouping the studies according to
> their type of control (two groups).
>
> In the forest plot, I can see the total sample size of the whole sample of
> studies, but the forest plot does not print the total sample size by the
> group. Instead, it prints a point.
>
> I do not know why.
>
> Usually the forest plot after the ‘update byvar’ print the total sample
> size by the group, as in the fig. 2.8 of Schwarzer, Carpenter, Rucker,
> Meta-analysis with R, Springer, 2015.
>
> What can I do?
>
> Thank you in advance,
> Antonello Preti
>
> ### Here the data and the codes I have used.
>
> ### The data
>
> datAgg <- structure(list(Study = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L,
> 8L, 9L, 10L, 11L, 13L, 14L, 15L, 16L), .Label = c("Amber et al. 2015
> Other ",
> "Beta et al. 1994 TAU ", "Gemma†et al. 2012 TAU ",
> "Delta et al. 2015 Other ", "Delta et al. 2015 TAU ",
> "Heta 1989 Other ", "Heta 1989 TAU ",
> "Lemme et al. 2008 Other ", "Roda et al. 2011 Other ",
> "Saint et al. 2013 TAU ", "Stabat et al. 2005 TAU ",
> "Spera et al. 1999 Other ", "Tania et al. 2016 TAU ",
> "Vanda et al. 2002 TAU ", "Vasto et al. 2005 Other ",
> "Vasto et al. 2005 TAU ", "Wolf et al. 2005 Other ",
> "Wolf et al. 2005 TAU "), class = "factor"), yi =
> c(0.413781967817236,
> 0.897867818781807, -0.629691420114331, -0.0570629170645163,
> 0.100199348083711,
> 0.166720438987659, -0.0791416968479593, -0.516848713049707,
> -0.588171436440896,
> 1.68578725963673, 0.549424389382073, -0.528085519326364,
> 0.0552725558889493,
> 0.450384415544429, 0.455766346836709), vi = c(0.0526848369519856,
> 0.0653245457221679, 0.0403678427142577, 0.0460018003388296,
> 0.0465699994730023,
> 0.200694892619406, 0.200156585204499, 0.0574699191913509,
> 0.0542032153656511,
> 0.060279300844124, 0.0988317519005698, 0.039802280364049,
> 0.0952744649456488,
> 0.0446012425417145, 0.0441325163026295), tr = c(42, 40, 52, 43,
> 43, 10, 10, 41, 38, 38, 21, 52, 21, 47, 47), ct = c(36, 29, 52,
> 44, 43, 10, 10, 32, 39, 54, 21, 52, 21, 45, 46), group = c("Vale",
> "ADE", "ADE", "Vale", "ADE", "Vale", "ADE", "Vale", "Vale",
> "ADE", "ADE", "ADE", "ADE", "Vale", "ADE"), sem = c(0.229531777651779,
> 0.255586669687932, 0.200917502259653, 0.214480302915745, 0.215800832883014,
> 0.447989835397418, 0.44738862882789, 0.239728845138316, 0.232815840023077,
> 0.245518432799095, 0.314375176978988, 0.199505088566806, 0.308665619960579,
> 0.211190062601711, 0.210077405502423)), row.names = c(NA, -15L
> ), class = "data.frame")
>
>
> ###########################################################
> #
> # Analysis with 'meta'
> #
> ###########################################################
>
> ### aggregated data, check
>
> head(datAgg)
>
>
> ### call the library
>
> library(meta)
>
> ### analysis
>
> meta1 <- metagen(TE=yi, seTE=sem, data=datAgg, studlab=datAgg$Study,
> sm="SMD", hakn=TRUE, method.tau="EB")
>
> ### add sample size to the results of the meta-analysis
>
> meta1$n.e=datAgg$tr
> meta1$n.c=datAgg$ct
>
> ### summary
>
> summary(meta1)
>
> ### forest plot
> ### digits.se=2 is the minimum number of significant digits for standard
> error (in this case = 2)
>
> forest(meta1, digits.se=2, leftcols=c("studlab","n.e", "n.c", "TE",
> "seTE"),
> leftlabs=c("Study", "n∞ \n Treated", "n∞ \n Controls", "Estimated \n
> Effect Size", "Standard \n error"))
>
>
> ###########################################################
> ### subgroup analysis
> ###########################################################
>
> modelsub <- update(meta1, byvar=group)
>
> summary(modelsub)
>
>
> ### add sample size to the results of the meta-analysis
>
> modelsub$n.e=datAgg$tr
> modelsub$n.c=datAgg$ct
>
> ###########################################################
> ### forest plot
> ###########################################################
>
> ### save as .tiff
>
> tiff("Figure.tiff", width = 12, height = 8, units = 'in', res = 300,
> compression = 'lzw')
>
> ### forest plot
> ### digits=2 is the minimum number of significant digits for data
>
> forest(modelsub,studlab=paste(datAgg$Study), print.byvar=FALSE,
> fontsize=10,fs.heading=10,digits=2,
> leftcols=c("studlab","n.e", "n.c"),comb.fixed=T, overall=T, col.by="black",
>
> leftlabs=c("Study", "n∞ \n Treated", "n∞ \n Controls"))
>
> dev.off()
> ### done
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Michael
http://www.dewey.myzen.co.uk/home.html
More information about the R-help
mailing list