Skip to content

[R-meta] Setting non-log x axis and tick marks organized when "atransf = exp" is used in the forest plot

3 messages · Wolfgang Viechtbauer, Win Thu

#
Hello,

Currently, I finished a meta-analysis using metafor. *Please advise how I
can keep the X axis scale organized in the forest plot without needing to
change it into a log scale when "atransf = exp" is used in the forest
function.*

I used "atransf = exp" as I want to show the risk estimates and the result
on a normal scale in the forest plot.
The code is: *forest (meta, atransf = exp) *which gave me a X axis and tick
marks not organized well and sometimes bizarre (fig below).


[image: Screen Shot 2023-06-02 at 11.38.05 PM.png]

I need to use: *forest (meta, atransf = exp, at = log (c(0.5,1,1.5)) *to
get a more organized x axis (fig below) but the X axis scale is now in log
scale while the result is not in log scale. The journal I want to publish
asks to keep the X axis scale same with the relative risk scale. I want to
keep relative risk on a normal scale, and thus, the X axis should not be in
log scale.

Your help will be greatly appreciated as I was trying several days and
hours without success.
[image: Screen Shot 2023-06-02 at 11.39.46 PM.png]

Thank you very much in advance,
Win

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230602/a46a322e/attachment-0001.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2023-06-02 at 11.38.05 PM.png
Type: image/png
Size: 17405 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230602/a46a322e/attachment-0002.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2023-06-02 at 11.39.46 PM.png
Type: image/png
Size: 15469 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230602/a46a322e/attachment-0003.png>
#
Dear Win,

I am not entirely sure I understand exactly what you want, but I think you want to use the 'transf' argument instead of 'atransf'. For example:

library(metafor)

dat <- dat.bcg
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat, 
              slab=paste0(author, ", ", year))
res <- rma(yi, vi, data=dat)

# forest plot of the log risk ratios
forest(res, header=TRUE)

# forest plot of the risk ratios (log scale for the x-axis)
forest(res, header=TRUE, atransf=exp, at=log(c(0.05, 0.25, 1, 4)))

# forest plot of the risk ratios
forest(res, header=TRUE, transf=exp, alim=c(0,4), refline=1)

In the last case, the CIs will be asymmetric since exp() is a non-linear transformation.

Best,
Wolfgang
3 days later
#
Dear Wolfgang,

Thank you very much for prompt help. It works!
Thank you also for adding shade function in the latest version which is
really helpful.

Best regards
Win

On Sat, 3 Jun 2023 at 1:02 AM, Viechtbauer, Wolfgang (NP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: