Announcement

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

  • Manipulating the graphic (forest plot) from metan

    I am looking to use metan to create a forest plot of several odds ratios I have. (I'm not actually doing an meta-analysis; just want to use the forest plot to present several outcomes from a clinical trial.)

    I am using the following code, and I get a forest plot with some cosmetic problems.

    metan estimate lowercl uppercl, ///
    label (namevar = outcomes) ///
    nowt nooverall nobox ///
    effect(Odds Ratio) ///
    ///xlab (0.50, 1.0, 5.0)///
    null (1) ///
    astext(70) textsize(250)

    The biggest issues are the following:
    (1) When I attempt to control the scale of the x axis using the "xlab" command (commented out above), the commands for textsize and assigning the null line to "1" do not work. When I comment-out the "xlab" statement, the others work, but I get a somewhat arbitrary scale for the x axis.

    (2) The column labels (e.g., "Odds Ratio") are printed in double spaced font (unsuitable for publication) and several options I've tried to reformat don't seem to work.

    Does anyone have suggestions about how to control the appearance of the forest plot more?

    Thanks!

  • #2
    Hi John,
    Sorry for the late reply, hope this is still useful to you.
    I have recycled a lot of the metan command's code for my own programs with the ipdmetan package (available from SSC -- type ssc describe ipdmetan or ssc install ipdmetan at the Stata command line). I also was frustrated with the lack of flexibility in the appearance of metan's basically well-made forest plots. If you already have your data set up for metan, you could try using my command admetan, as follows (based on your syntax above):
    Code:
    admetan estimate lowercl uppercl, study(outcomes) nowt nooverall nobox or forestplot(xlab(.5, 1, 5))
    I've removed the "null" option as it shouldn't be needed if "or" is specified, whilst the way aspect ratios and text sizes are calculated is quite different to metan, so you may want to start again with "astext" and "textsize".
    If you try this and have any questions, please let me know and I will be happy to help further.
    Thanks,
    David.

    Comment


    • #3
      Hi Both

      Do you know of a code to make the point estimates different sizes, i.e. to represent the size of a trial included in the meta-analysis? Apologies if it's in the help section already, I was just looking for a quick fix.

      Thanks
      Gemma

      Comment


      • #4
        Hi Gemma,

        I assume that you wish to override the default weighting? By default, point estimates are weighted by the inverse of their variances.

        There are several options for overriding the default weighting:

        (1) Simply overwrite the observed standard errors/variances with values which result in the sizing you desire. This may have undesirable consequences, though, such as your confidence limits also being changed.

        (2) Use the "first()" and "wgt()" options to metan; see help metan (disclaimer: I've never used these particular options myself, so am not familiar with them. Also, you'll have to obtain your pooled estimate separately, as these options suppress any actual modelling)

        (3) With admetan, save the results using the "saving()" option and edit the weighting as desired (variable "_WT") before typing forestplot (see help admetan)

        Hope that helps -- let us know if e.g. there are any additional complexities in your data.

        Thanks,

        David.

        Comment


        • #5
          Dear all,
          I have similar problem but problem with xlab, in admetan and metan command
          problem with noofstudy include ?? in the graph how do i get rid of this question mark
          and the plot are very narrow, i want to include the xlabel
          when i include the xlabel it give "invalid '1'"
          can you please help to solve this problem . below is my command

          admetan odd lci uci, lcols(Predictor noofstudy) ///
          effect(OR) rcols(cpvalue isq) nowt nooverall ///
          forestplot(favours(Decreased Risk#Increased Risk) xlabel(0.1,0.2,0.5,1, 2,10) force))

          *also i try the metan command this one also xlable is overlap

          metan replace odd replace lci replace uci, lcols(Predictor noofstudy) ///
          effect(OR) rcols(cpvalue isq) nobox nowt nooverall ///
          xsize(8) ysize(8) nulloff nohet double ///
          favours(Decreased Risk#Increased Risk) astext(90) xlabel(0.1,0.2,0.5,1, 2,10) force


          Thanks
          Sugan

          Attached Files

          Comment


          • #6
            Hi Sugan,

            In terms of the question marks from admetan, I released an update last year that should have fixed this problem. If you type which ipdmetan at the command line, what is the result? If it does not say "*! version 1.07 David Fisher, 29jun2015", please try updating it by typing ssc update ipdmetan. (N.B. the admetan command that you are using is part of the larger ipdmetan package.)

            Once you've updated and (hopefully) gotten rid of those question marks, let me know if I can help with improving the look of your graph further.

            Thanks,

            David.

            Comment


            • #7
              Dear Dr.David
              Thanks for your reply. I just updated admetan as you told me.below list is my data
              HTML Code:
               list Predictor noofstudy combine_odd combine_lci combine_uci cpvalue isq, clean noobs
              
                  Predic~r   noofst~y   combin~d   comb~lci   comb~uci   cpvalue   isq  
                       x10          1         .2        .08         .7     <0.01     -  
                       x11          1         .3         .1         .8      0.02     -  
                        x4          1        .68         .5         .8     <0.01     -  
                        x7          1        1.8       1.02          3      0.04     -  
                       x13          1        1.1       1.01        1.1     <0.01     -  
                       x12          1        2.7          2        3.6     <0.01     -  
                        x9          3         .8         .4        1.9     <0.01   91%  
                        x1          4        1.1         .9        1.3      0.08   60%  
                        x5          5          4       2.02        7.7      0.50   61%  
                        x3          7        1.3        1.1        1.6     <0.01   74%  
                        x8          8        8.4       5.02         15      0.01   60%  
                        x6          9        1.2          1        1.6     <0.01   85%  
                        x2         13        1.1       1.03        1.2     <0.01   87%  
              I just want to present these result into forest plot.. when I use admetan I have some question
              1. why the confidenc interval change but I want the value as it is in my data set.
              2. And the lable of predictor does not show
              3. When I use the xlable within admetan it’s says “invalid '0.5'”
              admetan combine_odd combine_lci combine_uci, lcols(Predictor noofstudy) ///
              rcols(cpvalue isq) nowt nooverall ///
              forestplot(favours(Decreased Risk#Increased Risk) xlabel(0.1,0.2,0.5,1, 2,10) force)
              1. Sinces I don’t have study why they study number appear?
              2. Withous the xlable the plots is very narrow and the xlable wider
              Please advice me how to solve these problem to look he plot nice.

              looking forward to hearing from you
              Thank you so much


              Comment


              • #8
                Hi Sugan,

                Thanks for showing me your data. Probably the most important issue is that both metan and admetan assume that the effect size and confidence limits are given on the linear scale rather than the exponential scale. In other words, you need to provide log odds ratios and log confidence limits, and specify the eform option to metan/admetan.

                Code:
                gen lnor = ln(combine_odd)
                gen lnlci = ln(combine_lci)
                gen lnuci = ln(combine_uci)
                Next, taking your specific questions one at a time:

                1. Both metan and admetan use inverse-variance weighting by default, and the variances are derived from the confidence limits. However, in producing the forest plot, the confidence limits are re-calculated from those variances, so that if the input data precision is low, it is possible you may not get precisely the same limits as you put in. (Having said all that, hopefully inputting log odds ratio and log confidence limits will fix this anyway.)

                2. I'm not sure what you mean here, except that I noticed that sometimes the title of this variable was clipped to "Predic". This is a bug, which I shall try to fix in the next version. In the meantime, you can fix it by adding some blank space at the end of each value of the Predictor variable, as follows:
                Code:
                replace Predictor = Predictor + "      "
                3. The "invalid '0.5'" error is due to admetan expecting xlabel values separated by spaces -- as is usual with twoway graphs in Stata -- rather than commas as in metan. See help ipdmetan. You need to replace
                Code:
                xlabel(0.1,0.2,0.5,1, 2,10) force
                with
                Code:
                xlabel(0.1 0.2 0.5 1 2 10)

                (the force option shouldn't be needed)

                1. Again, this is... well, perhaps a bug; certainly a difference in coding between metan and admetan. admetan generates a dummy Study variable if one is not supplied, whereas metan uses the first variable in lcols() in that situation. I may change the way admetan behaves in the next version, but in the meantime you can fix it by supplying the variable Predictor to the study() option rather than the lcols() option.

                In addition, you will notice that the observations are sorted by Predictor; but since this is a string variable, "x1" will be immediately followed by "x10" rather than by "x2". We can fix this using the sortby() option:
                Code:
                gen predno = real(substr(Predictor, 2, .))
                label var noofstudy "No. of studies"
                label var cpvalue "p-value"
                label var isq "I-squared"
                
                admetan lnor lnlci lnuci, study(Predictor) sortby(predno) eform effect(Odds ratio) ///
                   lcols(noofstudy) rcols(cpvalue isq) nowt nooverall ///
                   forestplot(favours(Decreased Risk#Increased Risk) xlabel(0.1 0.2 0.5 1 2 5 10))

                2. This is, I think, again due to supplying values on the exponential scale rather than on the linear scale (see above).


                Hopefully this will give you a better-looking plot! Thanks again for supplying your data; every new example like this means that I can try to improve admetan in the next version.

                Best wishes,

                David.






                Comment


                • #9
                  Dear Mr. David,
                  I truly appreciate your time and effort to explain step by step explanation. Now the forest plot looks very nice. Thank you so much.
                  Sugan

                  Comment


                  • #10
                    This is a really helpful guide for manipulating forest plot illustrations

                    Comment


                    • #11
                      Dear David,

                      I am using Stata 14.2 version. I have the same problem with forest plot as mentioned by Sugan using admetan command..And I see that I have ipdmetan version 1.06. I am unable to update it to 1.07 using the ssc update ipdmetan. I get an error message

                      which ipdmetan
                      c:\ado\plus\i\ipdmetan.ado
                      *! version 1.06 David Fisher 23jul2014

                      . ssc update ipdmetan
                      ssc: update: invalid subcommand
                      r(198);

                      . adoupdate ipdmetan
                      (note: adoupdate updates user-written files; type -update- to check for updates to official Stata)
                      (no packages match "ipdmetan")

                      Can you please let me know where is the problem ??
                      I am in really need to get rid of the ??? before the numbers in the forest plot

                      Thanks
                      Niveditha

                      Comment


                      • #12
                        Dear Niveditha,

                        Sorry to hear you're having problems.

                        "adoupdate ipdmetan" works on my system. The correct "ssc" syntax is "ssc install ipdmetan, update" rather than "ssc update ipdmetan".

                        Please try these again after checking your Internet connection, firewall settings, etc. Also, have you successfully installed and/or updated any other Stata user-written packages recently, either from SSC or from elsewhere? If you really can't get it to work, please email me (my address is in the ipdmetan help file) and I can send you the updated code files by email.

                        Thanks,

                        David.

                        Comment


                        • #13
                          Dear David,

                          Thank you very much. It worked when I typed "ssc install ipdmetan, replace". With "ssc install ipdmetan, update" I was getting a r(602) error message (saying that Stata will not erase files, but can do if ", replace" option).
                          Now the version of ipdmetan I have is "*! version 2.0 David Fisher 11may2017" and my graphs are good without "???" before the numbers.

                          Thank you
                          Niveditha

                          Comment


                          • #14
                            Dear Niveditha,
                            Great! Glad you've gotten it working. Sorry that my syntax suggestion wasn't quite right either...!
                            Feel free to ask if you have any further questions about the program, either via this forum or via email (mine is in the ipdmetan help file).
                            Best wishes,
                            David.

                            Comment


                            • #15
                              Dear All,
                              It has been really useful following this thread here.

                              My question is to David Fisher I wrote to you about my experience with ipdover a while back but I am wondering if you can advise me on metan.

                              Is there a way to have the forest plot include both the effect size and 95%CI (the default) as well as the raw counts for the outcome?

                              This is useful for my analysis because I am using the command to analyse binary data in a 2x2 table for example:

                              metan outcome_exposure no_outcome_exposure outcome_control no_outcome_control, or random xlab(0.1, 0.5, 1, 5, 10) label(namevar= study_id, yearvar=year)

                              Can a further 2 columns be added to the forest plot which would have the outcome/no_outcome for exposure and control groups?

                              Many thanks,
                              Alexander
                              Many thanks,
                              Alexander
                              (Stata v14.2 IC for Mac)

                              Comment

                              Working...
                              X