Dear all, I use metafor package to generate a forest plot showing the weight of each study in the plot. I use the code: library(metafor) data(dat.bcg) res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR", slab=paste(author, year, sep=", "), method="REML") forest(res, showweights=TRUE) It is possible to order the columns, placing the weights after effect size and CI? A further query: using escalc (or rma), it is possible to add the weight of each study (other than yi and vi) to the data (in the example: data.bcg)? Thanks for your attention ________________________ Mario Petretta Professor of Internal Medicine Department of Translational Medical Science Naples University ?Federico II? - Italy _____ <http://www.avast.com/> Questa e-mail ? priva di virus e malware perch? ? attiva la protezione avast! Antivirus <http://www.avast.com/> . Nessun virus nel messaggio. Controllato da AVG - www.avg.com Versione: 2014.0.4259 / Database dei virus: 3705/7093 - Data di rilascio: 14/02/2014 --- Questa e-mail ? stata controllata per individuare virus con Avast antivirus. https://www.avast.com/antivirus [[alternative HTML version deleted]]
See below On 09/12/2015 18:48, Mario Petretta wrote:> Dear all, > > > > I use metafor package to generate a forest plot showing the weight of each study in the plot. > > > > I use the code: > > library(metafor) > > data(dat.bcg) > > res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR", > > slab=paste(author, year, sep=", "), method="REML") > > forest(res, showweights=TRUE) > > > > It is possible to order the columns, placing the weights after effect size and CI? >There are some fairly extensive examples in the forest.rma documentation. You will also need some patience to get everything exactly where you want it and looking exactly how you want. Graphics are like that.> > > A further query: using escalc (or rma), it is possible to add the weight of each study (other than yi and vi) to the data (in the example: data.bcg)? >You can extract the weights from the fitted object using weights.ram.uni and put them in the data frame yourself. I am a bit worried about your mention of escalc, you do realise that the weights are a function of the fit, not the data? So weights(res) should be OK here (not tested).> > > Thanks for your attention > > > > ________________________ > > > > Mario Petretta > > Professor of Internal Medicine > > Department of Translational Medical Science > > Naples University ?Federico II? - Italy > > > > > > _____ > > > <http://www.avast.com/> > > Questa e-mail ? priva di virus e malware perch? ? attiva la protezione avast! Antivirus <http://www.avast.com/> . > > > > Nessun virus nel messaggio. > Controllato da AVG - www.avg.com > Versione: 2014.0.4259 / Database dei virus: 3705/7093 - Data di rilascio: 14/02/2014 > > > > --- > Questa e-mail ? stata controllata per individuare virus con Avast antivirus. > https://www.avast.com/antivirus > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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
Many thanks to Professor Michael Dewey for his time. I apologize for the error about the claim to obtain weights from escalc and I realise that the weights are a function of the fit, not the data. weights(res) is OK to extract the weights from the fitted object and to put them in the data frame. However, I again ask: Using: forest(res, showweights=TRUE) it is possible to directly order the columns, simply placing the weights after effect size and CI? Sincerely Mario Petretta -----Messaggio originale----- Da: Michael Dewey [mailto:lists at dewey.myzen.co.uk] Inviato: venerd? 11 dicembre 2015 14.47 A: Mario Petretta; r-help at r-project.org Oggetto: Re: [R] forest plot metafor See below On 09/12/2015 18:48, Mario Petretta wrote:> Dear all, > > > > I use metafor package to generate a forest plot showing the weight of each study in the plot. > > > > I use the code: > > library(metafor) > > data(dat.bcg) > > res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, > measure="RR", > > slab=paste(author, year, sep=", "), method="REML") > > forest(res, showweights=TRUE) > > > > It is possible to order the columns, placing the weights after effect size and CI? >There are some fairly extensive examples in the forest.rma documentation. You will also need some patience to get everything exactly where you want it and looking exactly how you want. Graphics are like that.> > > A further query: using escalc (or rma), it is possible to add the weight of each study (other than yi and vi) to the data (in the example: data.bcg)? >You can extract the weights from the fitted object using weights.ram.uni and put them in the data frame yourself. I am a bit worried about your mention of escalc, you do realise that the weights are a function of the fit, not the data? So weights(res) should be OK here (not tested).> > > Thanks for your attention > > > > ________________________ > > > > Mario Petretta > > Professor of Internal Medicine > > Department of Translational Medical Science > > Naples University ?Federico II? - Italy > > > > > > _____ > > > <http://www.avast.com/> > > Questa e-mail ? priva di virus e malware perch? ? attiva la protezione avast! Antivirus <http://www.avast.com/> . > > > > Nessun virus nel messaggio. > Controllato da AVG - www.avg.com > Versione: 2014.0.4259 / Database dei virus: 3705/7093 - Data di > rilascio: 14/02/2014 > > > > --- > Questa e-mail ? stata controllata per individuare virus con Avast antivirus. > https://www.avast.com/antivirus > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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