Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Meta forestplot: problems with axis range/labels

    I am having trouble setting axis range and labels using meta forestplot. I am using Stata 16.1.

    I am trying to display the results of a forest plot of vaccine efficacy trials, with 2 group binary variables, that are combined using log RR.
    After using the forestplot transform function (transform(efficacy)) to exponentiate the log relative risk and subtract from 1 to show vaccine efficacy, I cannot suitably modify the axis range or title.

    Here is my example code:

    Code:
    input id HepB3_HBsAg HepB3_HBsAg_neg unvac_HBsAg unvac_HBsAg_neg
    id HepB3_HBsAg HepB3_HBsAg_neg unvac_HBsAg unvac_HBsAg_neg
    1. 2 253 59    416
    2. 2 90    19 29
    end
    meta esize HepB3_HBsAg HepB3_HBsAg_neg unvac_HBsAg unvac_HBsAg_neg, esize(lnrratio) studylabel(id) random(sjonkman)
    Here is the default output:
    Code:
    meta forestplot, transform(Vaccine efficacy: efficacy)
    Which produces a forestplot with unusual x axis labels at 0.63 to 0.98., as below. I'd like to set this to 0 to 1.0, with 0.2 interval labels.
    Click image for larger version

Name:	Graph1.png
Views:	1
Size:	43.7 KB
ID:	1583290



    This is what happens if I try to change the axis range using xcale or xlabel using either of these commands:
    Code:
    meta forestplot, transform(Vaccine efficacy: efficacy) xscale(range(0 1))
    meta forestplot, transform(Vaccine efficacy: efficacy) xlabel(0 0.5 1)
    Click image for larger version

Name:	Graph2.png
Views:	1
Size:	41.4 KB
ID:	1583291



    If I use untransformed values for the scale range, I can change the range so it is more suitable, but I am unable to change the axis labels:
    Code:
    meta forestplot, transform(Vaccine efficacy: efficacy) xscale(range(-4.6 -2.3))
    Click image for larger version

Name:	Graph3.png
Views:	1
Size:	43.1 KB
ID:	1583292



    Code:
    meta forestplot, transform(Vaccine efficacy: efficacy) xscale(range(-4.6 -2.3)) xlabel(0 0.5 1)
    Click image for larger version

Name:	Graph4.png
Views:	1
Size:	40.6 KB
ID:	1583293


    It also doesn't work if I use untransformed figures for the xlabels (eg. xlabel(-4.6, -2.3))
    Assistance on how to achieve a scale from 0 to 1.0 with suitable x axis labels would be much appreciated.

    Alex

  • #2
    Is there a method to plot this meta forestplot output on a linear scale even though the underlying data are based on log-transformed values?

    Comment


    • #3
      Hi Alex,

      You should specify x-axis labels on the output metric, which is the efficacy metric if you specified option transform(efficacy). The range of your data is .74 to .99 so it is preferable to choose values between these 2 numbers. For example,
      Code:
       meta forest, transform(Vaccine efficacy: efficacy) esrefline xlabel(.75 .95 .99)
      Click image for larger version

Name:	Graph1.png
Views:	1
Size:	106.0 KB
ID:	1584087


      Notice how the value labels seem equidistant even though .95-.75 = .2 is far larger than .99 - .95 = .04. This because these labels are plotted on the efficacy metric and the corresponding values on the original log(RR) metric are in fact equidistant (they are roughly -1.4, -3, and -4.6; take log(1-efficacy) for each value). If you would like to plot the data on the [0,1] range, you could do something like:
      Code:
      meta forest, transform(Vaccine efficacy: efficacy) esrefline xlabel(0 .999, format(%9.0f))
      Click image for larger version

Name:	Graph2.png
Views:	1
Size:	103.7 KB
ID:	1584088


      For now, you should avoid specifying the value 1 in options range() or xlabel() when the efficacy transformation is chosen. This is because when efficacy = 1, the RR is 0 which is computationally not possible since a continuity correction of 0.5 is usually added by default to the zero cells to avoid this scenario. Finally, you mentioned that you would like to have labels between 0 and 1 with 0.2 intervals. This choice would not look nice for this example since you are plotting these values on the efficacy metric (and the range of your values are .74 to .99). You may play with the following code to add more value labels between 0 and 1
      Code:
      meta forest, transform(Vaccine efficacy: efficacy) esrefline xlabel(0 0.80 0.98 .999, format(%9.2f))
      I hope this helps!

      Comment

      Working...
      X