Forest plot construction in R software
0
0
Entering edit mode
6.5 years ago
tesfadej2003 ▴ 10

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.

R forstplot rmeta • 3.7k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

could you post example data here?

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1605 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6