How do I get rid off pre-printed text in Forest Plot using Metafor/R?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How do I get rid off pre-printed text in Forest Plot using Metafor/R?



I am using the Metafor package to produce meta-analysis and subsequently a Forest Plot. When I print my Forest Plot a "RE Model"-text appears automatically as shown on the attached print. I can't figure out how to remove the "RE Model" although I use a separate text-script. I just want my "own" text to appear aligned with the polygon. Can you help?



enter image description here



First "load data" and then my script:


### Load data
dat <- structure(list(study = structure(c(4L, 5L, 3L, 1L, 2L, 7L, 6L
), .Label = c("Battaglia et al.", "Hong et al.", "Kosyakove et al.",
"Lim et al.", "Rauch et al.", "Swachia et al.", "Tsounis et
al."
), class = "factor"), n1i = c(20L, 121L, 25L, 18L, 31L, 35L,
22L), m1i = c(12.8, 30.2, 24.6, 21, 25, 27,
18.2), sd1i = c(15.4,

21.6, 17, 33, 18, 13.8, 8.72), n2i = c(20L, 129L, 25L, 17L, 32L,

34L, 20L), m2i = c(12.1, 28.7, 25.1, 31, 26, 28.6, 14.7), sd2i = c(14.6,

21.6, 12.2, 25, 19, 24.2, 12.9), ntotal = c(40L, 250L, 50L, 35L,

63L, 69L, 42L), mean.age = c(3L, 3L, 1L, 4L, 4L, 3L, 3L), demograhic =
c(0L,

2L, 1L, 1L, 0L, 1L, 0L), adjusted.comorbid = c(1L, 1L, 1L, 1L,

0L, 1L, 1L), follow.up = c(1L, 3L, 3L, 1L, 2L, 2L, 2L), severity = c(2L,

4L, 1L, 4L, 4L, 4L, 4L), treat.sys = c(1L, 2L, 1L, 2L, 1L, 2L,

1L), treat.int = c(1L, 1L, 2L, 1L, 2L, 1L, 1L), year = c(2000L,

2000L, 2000L, 2000L, 2000L, 2000L, 2000L), citation = c(1L, 2L,

3L, 4L, 5L, 6L, 6L), yi = structure(c(0.700000000000001, 1.5,

-0.5, -10, -1, -1.6, 3.5), measure = "MD", ni = c(40L, 250L,

50L, 35L, 63L, 69L, 42L)), vi = c(22.516, 7.47261195464155, 17.5136,

97.2647058823529, 21.7328629032258, 22.6658487394958, 11.7767909090909

)), .Names = c("study", "n1i", "m1i", "sd1i", "n2i", "m2i", "sd2i",

"ntotal", "mean.age", "demograhic", "adjusted.comorbid", "follow.up",

"severity", "treat.sys", "treat.int", "year", "citation", "yi",

"vi"), row.names = c(NA, -7L), class = c("escalc", "data.frame"

), digits = 4, yi.names = "yi", vi.names = "vi")



AND my code


### My code
res <- rma(yi, vi, data=dat, slab=paste(study, year, citation, sep=", "), method = "REML")
forest(res, xlim=c(-39,24), at=c(-12,-9,-6,-3,0,3,6,9,12), showweights = TRUE,
ilab=cbind(dat$m1i, dat$n1i, dat$sd1i, dat$m2i, dat$n2i, dat$sd2i),
ilab.xpos=c(-26,-24,-22,-18,-16,-14), cex=1, ylim=c(-2, 10), font=1, digits=2, col="darkgrey")

### Add own text
text(-39, -2, pos=4, cex=0.9, font=2,
bquote(paste("Random-effects model for all studies: Q = ",
.(formatC(q1$QE, digits=2, format="f")),
", df = ", .(q1$k - q1$p),", p = ",
.(formatC(q1$QEp, digits=2, format="f")),
", ", I^2, " = ",
.(formatC(q1$I2, digits=1, format="f")),
"%", ", ", tau^2 ==
.(formatC(q1$tau2, digits=2, format="f")))))



Thank you in advance!





I tried to run your "load data" code, but the dat object isn't there. Please can you update your question so that we can load your data?
– meenaparam
22 hours ago


dat





@meenaparam should be fixed - thank you.
– Christian Mirian Larsen
3 hours ago




1 Answer
1



To make your forest plot without the "RE Model" text in the bottom left hand corner, just use the mlab = "" argument in your forest function call.


mlab = ""


forest


forest(res, xlim=c(-39,24), at=c(-12,-9,-6,-3,0,3,6,9,12), showweights = TRUE,
ilab=cbind(dat$m1i, dat$n1i, dat$sd1i, dat$m2i, dat$n2i, dat$sd2i),
ilab.xpos=c(-26,-24,-22,-18,-16,-14), cex=1, ylim=c(-2, 10),
font=1, digits=2, col="darkgrey", mlab = "")



enter image description here



Unfortunately I can't run the "Add own text" section of your provided code as you do not provide your q1 object. But you should be able to solve that yourself.


q1



I figured this out using the Metafor-Project site, specifically their page on forest plots.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived