Question: Forest plot construction in R software
0
gravatar for tesfadej2003
22 months ago by
tesfadej200310
tesfadej200310 wrote:

I am constructing a forest plot using 'rmeta' package in R.

code;

model.FE4 <- meta.MH(totemploy, totunemploy, employbfed, unemploybfed, names=Studies, 
                     data= employmentcomplete)

tabletext<-cbind(c("","Studies", model.FE4$names,NA,"Summary"),
                 c("Breastfeed","(G.Employed)", employmentcomplete$employbfed, NA, NA),
                 c("Breastfeed","(NG.Employed)", employmentcomplete$unemploybfed, NA, NA),
                 c("","OR", format(exp(model.FE4$logOR),digits=2),NA,
                   format(exp(model.FE4$logMH),digits=2)),
                 c( NA,NA,format(exp(model.FE4$logOR-model.FE4$selogOR*2),digits=2), NA, 
                    format(exp(model.FE4$logMH-model.FE4$selogMH*2), digits=2 )),
                 c("95% CI", NA, format(exp(model.FE4$logOR+model.FE4$selogOR*2), digits=2), NA, 
                   format(exp(model.FE4$logMH+model.FE4$selogMH*2), digits=2)))

m<- c(NA,NA,model.FE4$logOR,NA,model.FE4$logMH)
l<- m-c(NA,NA,model.FE4$selogOR,NA,model.FE4$selogMH)*2
u<- m+c(NA,NA,model.FE4$selogOR,NA,model.FE4$selogMH)*2

forestplot(tabletext, m, l, u, zero=0,is.summary=c(TRUE,TRUE, rep(FALSE, 6),TRUE), colgap=unit(12,"mm"),
           clip=c(log(0.05),log(3.5)), xlog = TRUE, boxsize = 0.5, xlab = "Non-exclusive   Exclusive",
           col=meta.colors(box="black",line="black", summary="blue"))

this is the output Rplot

I want to do 5 things.

  1. Avoid overlapping of the second and third columns.
  2. Adding test for heterogeneity values (Tau2, I2, X2, df, p-value) and test for overall effect (Z-value, p-value).
  3. Adding fixed- and random-effects model estimate.
  4. Adding the total number of events (column 2 and 3 separately).
  5. Adding a horizontal line for the column heading.

Thank you very much.

rmeta forstplot R • 1.7k views
ADD COMMENTlink modified 22 months ago by genomax70k • written 22 months ago by tesfadej200310

Hi, can you please give a link to the exact plot you need (I see the google images results page, with several plots). Which columns are you speaking about? Can you edit your post and add your code to it?

ADD REPLYlink written 22 months ago by Selenocysteine550

Thank you very much. Now, I have edited my question and make it more explanatory.

ADD REPLYlink written 22 months ago by tesfadej200310

could you post example data here?

ADD REPLYlink written 22 months ago by cpad011211k

Thank you very much.

The example data and forest plot which I want to optimize it found on the link below.

https://www.r-bloggers.com/r-and-meta-analysis/

ADD REPLYlink modified 22 months ago • written 22 months ago by tesfadej200310

I think that this will have to be done manually using things like mtext(), gridArrange(), mfrow (in par()), abline(), etc.

Just work through your wish list one by one and you'll get there. There are many plotting functions in R that can help you to produce what you want.

ADD REPLYlink modified 22 months ago • written 22 months ago by Kevin Blighe47k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 794 users visited in the last hour