[R-meta] Setting non-log x axis and tick marks organized when "atransf = exp" is used in the forest plot
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:
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
-----Original Message----- From: R-sig-meta-analysis [mailto:
r-sig-meta-analysis-bounces at r-project.org] On
Behalf Of Win Thu via R-sig-meta-analysis Sent: Friday, 02 June, 2023 13:52 To: r-sig-meta-analysis at r-project.org Cc: Win Thu Subject: [R-meta] Setting non-log x axis and tick marks organized when
"atransf =
exp" is used in the forest plot 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). 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. Thank you very much in advance, Win