Announcement

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

  • Forest plot of odd ratios in case control study (not derived from logistic regression)

    Dear Stata experts,
    I usually perform Forest plots for graphical display of results of logistic regression using COEFPLOT. which works perfect.
    I wonder how would it be possible to generate a simmilar looking forest plot for manually introdced data without need to use METAN function.
    For example, when i do case control study, i have my results in Odd ratios, but i want to graphically display these odd ratios in a forest plot. COEFPLOT wont work since the odd ratios here are not derived from logistic regression.
    Appreciate your help
    Sincerely
    Abugroun

  • #2
    Dear Abugroun,

    I have several suggestions, depending on the level of control you wish to have. I know coefplot is very flexible!

    Firstly: whyis using metan a problem? You can suppress all the meta-analysis functionality by using options such as nooverall, nowt, nohet etc.

    My next suggestion is to use forestplot, within the admetan package (ssc describe admetan). The forestplot command builds forest plots directly from the data in memory, without performing a meta-analysis, and honoring elements of data structure such as blank lines and additional rows/columns of text.

    Finally: I'm not too familiar with coefplot, but I think it allows you to input matrices, not just model names. Therefore, presumably you could package your observed odds ratios into a matrix, apply suitable row/column names, and pass to coefplot with similar options to those you would usually use.

    Best wishes,

    David.

    Comment


    • #3
      OR LCI UCI p valye
      Factor A 1.1 0.3 3.5 0.883
      Factor B 1.8 1.2 2.6 0.003
      Factor C 2.0 1.2 3.4 0.006

      Assuming i have such manaully calcualted data, and i want to plot it in a Forest plot.
      Wonder which code will handle this.
      I much appreciate your help.

      Comment


      • #4
        Well, the first thing to do is to log-transform the odds ratios and confidence limits. Having done so, you can apply metan, admetan or forestplot directly to the data. You would probably use the eform option to re-exponentiate to the odds ratio scale for plot display; see the documentation for these commands.

        For instance:

        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input str9 Study double(OR LCI UCI pvalue)
        "Factor A " 1.1  .3 3.5 .883
        "Factor B " 1.8 1.2 2.6 .003
        "Factor C "   2 1.2 3.4 .006
        end
        
        gen logOR = log(OR)
        gen logLCI = log(LCI)
        gen logUCI = log(UCI)
        
        label var Study " "
        format pvalue %5.3f
        
        metan logOR logLCI logUCI, nooverall eform effect(Odds Ratio) lcols(Study) rcols(pvalue)
        
        forestplot logOR logLCI logUCI, nowt or labels(Study) rcols(pvalue)

        Comment


        • #5
          Thats Amazing. Thanks a ton.

          Comment


          • #6
            I have similar qestion where I need to plot the results of an existing model, I tried above commands, the metan command works but produces indifferent marker colour and position, The forest plot command doesn't work at all. can you please help?

            my sytax is as follows

            gen logor=log(or)
            gen logLCI=log(var3)
            gen logUCI=log(var4)
            metan logor logLCI logUCI, nooverall eform effect(Odds Ratio) lcols(var1)

            Comment


            • #7
              Dear Muhammad,
              Your code looks fine, as far as it goes.
              Would it be possible for you to share your data -- or e.g. an anonymised sample of it -- in the same way that Ashraf did in an earlier message?
              Also please check that you have the "admetan" package installed, since "forestplot" is a part of this package and will not work without it. (To clarify, "forestplot" is NOT a part of the "metan" package.)
              Best wishes,
              David.

              Comment


              • #8
                Hi David

                forestplot logOR logLCI logUCI, nowt or labels(Study) rcols(pvalue) I got error "variable _LABELS not found" with the above command. Can you please advise? Thanks

                Comment


                • #9
                  Hi Phyu Zin ,

                  Unfortunately I am unable to recreate that error message with dummy data. Could you:
                  -- check what version you are using (type: which forestplot ) and update if necessary; the latest version is 4.04, Aug 2021
                  -- post a "minimal working example"; that is, a small snapshot of data which nevertheless triggers the error, so that I (or others) can run the identical command upon the identical data.

                  Thanks,
                  David.


                  P.S. Regarding updating, and for the benefit of other readers in relation to previous comments in this thread, please note that the advice I gave in post #7 is no longer correct. As of November 2020, forestplot is now a part of the metan package, and the admetan package is defunct. Therefore, in order to update the forestplot command, please first uninstall the admetan package (if appropriate) and then update the metan package (to version 4.04 Aug 2021).

                  ​​​

                  Comment

                  Working...
                  X