Announcement

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

  • Admetan - can it be combined?

    Dear Statalist,

    I am conducting a meta-analysis using admetan. I am comparing odds ratios for several studies. For some articles I have prevalences, for some they have given the OR's.

    I have made the following:
    Code:
    *OR by prevalence
    admetan aaa_dm naaa_dm aaa_nodm naaa_nodm, or ///
        forestplot(nobox lcols(study year) favours(Reduced risk of AAA # Increased risk of AAA)) ///
        nowt nooverall
    
    *Given OR
    foreach var of varlist or_cr-uci_ad {
        gen l`var'=ln(`var')
        }
    
    *Crude OR
    admetan lor_cr llci_cr luci_cr, or ///
        forestplot(nobox lcols(study year) favours(Reduced risk of AAA # Increased risk of AAA)) ///
        nowt nooverall
    
        
    *Adjusted OR
    admetan lor_ad llci_ad luci_ad, or ///
        forestplot(nobox lcols(study year) favours(Reduced risk of AAA # Increased risk of AAA)) ///
        nowt nooverall
    Can you combine the forest plots? I would like to combine "OR by prevalence" and "Crude OR".


    Best regards,
    Katrine

  • #2
    Dear Statalist,

    I found my way around it. I am convinced it could have been done in another way, but this was what I ended up with:

    Code:
    *OR by prevalence
    admetan aaa_dm naaa_dm aaa_nodm naaa_nodm, or ///
        forestplot(nobox lcols(study year) xlabel(0.2 0.5 1 2 5) cirange(.2 5) ///
        favours(Reduced risk of AAA # Increased risk of AAA)) nowt nooverall nograph
    
     
    replace or_cr=exp(_ES) if or_cr==.
    replace lci_cr=exp(_LCI) if lci_cr==.
    replace uci_cr=exp(_UCI) if uci_cr==.
     
     
    foreach var of varlist or_cr-uci_ad {
        gen l`var'=ln(`var')
        }
    
    gen grp=0
    replace grp=1 if !missing(lci_ad)
     
    sort year
    
    *Given OR  
    *Crude OR - given + calculated by prevalence
    admetan lor_cr llci_cr luci_cr if grp==0, or ///
        forestplot(nobox lcols(study year) rcol(total) xlabel(0.2 0.5 1 2 5) cirange(.2 5) ///
        favours(Reduced risk of AAA # Increased risk of AAA)) nowt nooverall keeporder
    
    * Manually generate "effect size" string(efter metaanalyse, hvor _ES/LCI/UCI er OR + CI)
    
    gen str estText = string(exp(_ES), "%10.2f") + " (" + string(exp(_LCI), "%10.2f") + ", " + string(exp(_UCI), "%10.2f") + ")"
    label var estText "OR (95% CI)" 
    
    admetan lor_cr llci_cr luci_cr if grp==0, or ///
        forestplot(nostat nobox lcols(study year) rcol(total estText) xlabel(0.2 0.5 1 2 5) ///
        cirange(.2 5) favours(Reduced risk of AAA # Increased risk of AAA)) nowt ///
        nooverall keeporder

    Best regards,
    Katrine

    Comment


    • #3
      Hi Katrine,

      Apologies for the delayed response; my "proper" job has been crazy these past weeks!

      Glad you found a way forward in the end. Your initial approach, where you derive "crude" ORs from the prevalence data and define a "group" variable, is absolutely correct.

      However, I'm a little confused as to what is going on in the second half of your code, and why you felt you needed to manually generate the "effect size" string? It may be that you are happy and have moved on; but if you are able, could you post a sample of your data using dataex? As it stands, I cannot see what your forest plot looks like, so cannot comment on how you might improve it and/or how you might simplify your code.

      Best wishes,

      David.

      Comment


      • #4
        Dear David,

        Thank you for your reply.
        I developed the code on the basis of your input with ipdmetan. I used the second half of the code initially to combine and get the output, I wanted. It might be me missing some sort of command (I am usually the limitation when it comes to stata), but I cannot get the OR at the outermost right without generating the effect size string and "rcol(tota estText)".

        * Example generated by -dataex-. To install: ssc install dataex
        Code:
        clear
        input str24 study float(total men aaa naaa aaa_men naaa_men aaa_dm aaa_nodm naaa_dm naaa_nodm or_cr lci_cr uci_cr or_ad lci_ad uci_ad year)
        "A"            3319993 1244997   .     .   .     .  .   .    .     .  1.32   1.28   1.37     .     .     . 2003
        "B"                 6142    6118 469  5673   .     . 87 382 1554  4119    .6    .47    .77     .     .     . 2007
        "C"         1101     722  40  1061  35   687  7  28  131   556     .      .      .     .     .     . 2014
        "D"                2597    2597 219  2378 219  2378 11 208  143  2235     .      .      .     .     .     . 1993
        "E"     651     651  15   636  15   636  3  12  156   480     .      .      .     .     .     . 2007
        "F"              1555     754  22  1533  19   735  1  18  101   634     .      .      .     .     .     . 2010
        "G"         14249   14249 168 14081 168 14081 10 158  647 13434     .      .      .     .     .     . 2007
        "H"       1009    1009  11   998  11   998  3   8  272   726     .      .      .     .     .     . 2013
        "I"                 500     500  41   459  41   459  3  38   10   449     .      .      .     .     .     . 1992
        "J"              8234    4327 512  7722 467  3860 66 401  809  6913     .      .      .     .     .     . 2007
        "K"               8146    8146 414  7732 414  7732 43 371  853  6879     .      .      .     .     .     . 2001
        "L"               1601     741  70  1531  65   676  9  56  215  1316     .      .      .     .     .     . 1991
        "M"            3755    2391  63  3692  56  2335 11  45  325  2010     .      .      .     .     .     . 2013
        "N"                4715    4715 107  4608 107  4608 19  88  709  3899     .      .      .     .     .     . 2008
        "O"             4734    1953 416  4318 252  1701 40 212  312  1389     .      .      .     .     .     . 1992
        "P"            14611   14611 233 14378 233 14378 24 209 1754 12624     .      .      .     .     .     . 2006
        "Q"               727     727  33   694  33   694  7  26   78   616     .      .      .     .     .     . 1995

        I hope it works, it is my first time using dataex.

        As you can see, I have OR for one of the studies in my raw data, but no prevalence. This is why I had to do it "combined".

        In the attached FP, I have more observations than the example



        Thank you for your help - now and in your old posts.


        Best regards,
        Katrine
        Attached Files

        Comment


        • #5
          Dear Katrine,

          Ah yes, I see what you're trying to do. In which case, there's not much more you can do ... however, in the most recent version (Dec 2018) I have made this sort of thing (switching left/right columns) slightly easier, by having admetan leave behind a variable named _EFFECT which contains the string effect size.

          So:

          Code:
          // [load data from dataex as before]
          
          qui admetan aaa_dm naaa_dm aaa_nodm naaa_nodm, nogr
          replace or_cr=exp(_ES) if or_cr==.
          replace lci_cr=exp(_LCI) if lci_cr==.
          replace uci_cr=exp(_UCI) if uci_cr==.
           
          foreach var of varlist or_cr-uci_ad {
              gen l`var'=ln(`var')
          }
          
          gen grp=0
          replace grp=1 if !missing(lci_ad)
          
          // Prepare column variables
          label var year "Year"
          label var total "N"
          format %-6s study
          
          // Create saved dataset containing all the data we need
          admetan lor_cr llci_cr luci_cr if grp==0, study(study) sortby(year) or ///
              forestplot(nobox lcols(year total) xlabel(0.2 0.5 1 2 5) ///
              cirange(.2 5) favours(Reduced risk of AAA # Increased risk of AAA) nowt nooverall) ///
              saving(myfile)
          
          // Now move npts to the right, before _EFFECT (that is, estText), and create final version of forestplot
          preserve
              use myfile, clear
              forestplot, useopts lcols(year) rcols(total _EFFECT) nostats
          restore


          Best wishes,

          David.

          Comment


          • #6
            Dear David,

            Thank you very much for your help. That did the trick - in fewer lines of code. I enjoy replacing a lot of lines in my do-file with fewer...


            Best wishes,

            Katrine

            Comment

            Working...
            X