Skip to content

[R-meta] Adjust the scale for x-axis using forest() function in the metafor package

5 messages · Michael Dewey, Wolfgang Viechtbauer, Thao Tran

#
Dear,
I want to plot an rma object using the forest() function in the metafor
package.
Here is a reproducible code to run it (please see the attachment).

[image: axis.png]

The problem is the x-axis does not scale as I expected even I tried using
at = ...
I wanted to have the x-axis scale from 1, to 1000 but with equal interval,
for example, between (0, 1e2), (1e2, 2e2), (2e2, 3e2)...
1-----100-----200-----300-----400-----500-----600-----700-----800-----900----1000
(something similar).

Do you have any suggestions?
Regards
Thao
#
Dear Thao

It is not wuite clear to me why you expect to see a linear scale on a 
plot using log values. I would suggest putting the ticks at places more 
evenly spaced on the log scale.

Michael
On 15/06/2020 16:32, Thao Tran wrote:

  
    
  
#
Hey Michael,
It is indeed a plot on the log-scale.
However, I did transform the values back to the original scale using
atransf = exp.
It is quite intuitive to see the 95% CI on the linear scale so the
variabilities of different studies can be seen clearly.
If you take a look at the plot above (in the previous email): the first
study had a very wide 95% CI (on the plot) although the values vary only
between 10 and 99.
The Roghmann study (fifth from the top) had a wide CI (from 400 to 1300)
but shows very short CI on the plot.

Regards,
Thao

On Mon, Jun 15, 2020 at 7:15 PM Michael Dewey <lists at dewey.myzen.co.uk>
wrote:

  
    
#
Dear Thao,

To be precise, you transformed the values shown on the x-axis back (through exponentiation) via the 'atransf' argument. Since exp() is a non-linear transformation, the spacing of the ticks will not be equidistant if the spacing on the log scale was equidistant to begin with (and vice-versa). Alternatively, you could use the 'transf' argument, which actually transforms all values back (not just the x-axis values that are shown). Then the spacing of the ticks will be equidistant (assuming that's how you specify the position of the ticks), but the CIs will no longer be symmetric (and appear to be of unequal widths even if the CIs are actually of equal width on the log scale). Compare:

yi <- log(c(.8, 1, 1.2, 1.4))
vi <- rep(.01, 4)
forest(yi, vi)
forest(yi, vi, atransf=exp, at=log(c(.5, 1, 1.5, 2)))
forest(yi, vi, transf=exp, at=c(.5, 1, 1.5, 2))

Best,
Wolfgang
#
Thanks, Wolfgang.

I will play around with it to see if I can come up with things that I want
to do.
A big thank you for your great support.

Thao.

On Tue, Jun 16, 2020 at 11:47 AM Viechtbauer, Wolfgang (SP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote: