Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Forest plot in meta package in R – remove weight boxes

I have run a meta-analysis on 10 studies and am now plotting the results on a forest plot. However, I have come across an annoying feature, where the study results which have small SE (fit within the weight box) turn to white, and don’t seem to obey the color.study argument. Is there any other way of bypassing this?
I wouldn’t mind losing the weight boxes altogether if that’s what’s necessary as weights are nearly the same.

df<-data.frame(study=c('s1','s2','s3','s4','s5','s6','s7','s8','s9','s10'),
SMD=c(0.016416141,0.299488949,0.024292283,0.110415656 ,0.160754906,-0.018112735,0.027915812,-0.025253501,-0.024464375,0.001146802),
se=c(0.013495131,0.021345836,0.010902911,0.006237354,0.014503043,0.012365650,0.009825055,0.006861558,0.018569984,0.021838104))

## Run meta-analysis
m.gen <- metagen(TE = SMD,
                 seTE = se,
                 studlab = study,
                 data = df,
                 sm = "SMD",
                 fixed = FALSE,
                 random = TRUE,
                 method.tau = "REML",
                 hakn = FALSE,
                 prediction = TRUE,
                 title = "Test")
    
## Plot forest plot
forest.meta(m.gen, 
            sortvar = TE,
            prediction = TRUE, 
            print.tau2 = FALSE,
            smlab="Test",
            print.I2=FALSE,
            print.I2.ci=FALSE,
            col.study='black'
            
)

forest plot

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

From ?forest.meta

col.inside – The colour for individual study results and confidence limits if confidence limits are completely within squares.

So the solution is to set col.inside = "black"

forest.meta(m.gen, 
            sortvar = TE,
            prediction = TRUE, 
            print.tau2 = FALSE,
            smlab = "Test",
            print.I2 = FALSE,
            print.I2.ci = FALSE,
            col.study = 'black',
            col.inside = "black"
)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading