Announcement

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

  • To describe the difference in relative risk instead of absolute risk reduction after logistic regress

    Hi,

    I just made a logistic regression. Of the independent remained after the forward selection, I used 'margins' to get the confidence interval of the absolute risk difference. However, I would like to get another output of relative risk.

    Code:
     logistic firsttherapeuticinrreached i.nonaaornonanona i.ageforttest i.af i.ttesttargetinr
    
    Logistic regression                             Number of obs     =        187
                                                    LR chi2(4)        =      25.32
                                                    Prob > chi2       =     0.0000
    Log likelihood = -84.409294                     Pseudo R2         =     0.1304
    
    --------------------------------------------------------------------------------------------
    firsttherapeuticinrreached | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ---------------------------+----------------------------------------------------------------
             1.nonaaornonanona |   .1526829    .073589    -3.90   0.000     .0593656    .3926867
                 1.ageforttest |   2.916752   1.356175     2.30   0.021     1.172531    7.255625
                          1.af |   .3494673    .161598    -2.27   0.023     .1411888    .8649931
              1.ttesttargetinr |   2.409212    1.35103     1.57   0.117     .8026778    7.231175
                         _cons |   4.008227   1.200546     4.64   0.000     2.228436    7.209492
    --------------------------------------------------------------------------------------------
    
    . margins i.nonaaornonanona
    
    Predictive margins                              Number of obs     =        187
    Model VCE    : OIM
    
    Expression   : Pr(firsttherapeuticinrreached), predict()
    
    ---------------------------------------------------------------------------------
                    |            Delta-method
                    |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ----------------+----------------------------------------------------------------
    nonaaornonanona |
                 0  |   .8367911   .0286637    29.19   0.000     .7806114    .8929709
                 1  |   .4675317   .0984477     4.75   0.000     .2745778    .6604856
    ---------------------------------------------------------------------------------
    
    . margins r.nonaaornonanona
    
    Contrasts of predictive margins
    Model VCE    : OIM
    
    Expression   : Pr(firsttherapeuticinrreached), predict()
    
    ---------------------------------------------------
                    |         df        chi2     P>chi2
    ----------------+----------------------------------
    nonaaornonanona |          1       12.88     0.0003
    ---------------------------------------------------
    
    -----------------------------------------------------------------
                    |            Delta-method
                    |   Contrast   Std. Err.     [95% Conf. Interval]
    ----------------+------------------------------------------------
    nonaaornonanona |
          (1 vs 0)  |  -.3692594   .1028906     -.5709214   -.1675975
    -----------------------------------------------------------------
    
    .
    Tom

  • #2
    I'm not sure exactly what you want, but I would look harder at the margins statement documentation and the contrast option. You can specify a wide variety of outputs in margins.

    Comment


    • #3
      Originally posted by Phil Bromiley View Post
      I'm not sure exactly what you want, but I would look harder at the margins statement documentation and the contrast option. You can specify a wide variety of outputs in margins.
      I don't need the odds ratio. Instead, I need the risk ratio.

      Tom

      Comment


      • #4
        I used the help to find this:

        Code:
        help logistic
        Title

        [R] logistic -- Logistic regression, reporting odds ratios


        Syntax

        logistic depvar indepvars [if] [in] [weight] [, options]


        Code:
        help logit
        Title

        [R] logit -- Logistic regression, reporting coefficients


        Syntax

        logit depvar [indepvars] [if] [in] [weight] [, options]


        So how to get the

        Logistic regression, reporting relative risk? Much appreciated!

        Comment


        • #5
          us poisson instead of logistic, be sure to use the "irr" option; another alternative is to use glm with family(binomial) and link(log)

          Comment


          • #6
            Originally posted by Rich Goldstein View Post
            us poisson instead of logistic, be sure to use the "irr" option; another alternative is to use glm with family(binomial) and link(log)
            To follow up on Rich's excellent suggestion, I would use robust SEs if I chose the Poisson model.
            Last edited by Andrea Discacciati; 06 Dec 2017, 06:31.

            Comment


            • #7
              So there is no direct way to report the relative risk by a single logistic regress syntax?

              and by the way, the

              Code:
              margins i.variable
              shows the absolute risk

              the

              Code:
              margins r.variable
              show the absolute risk difference

              Correct?

              Tom

              Last edited by Tom Hsiung; 06 Dec 2017, 06:56.

              Comment


              • #8
                I read from some ebooks at made a test, see below. Interesting.

                Code:
                . logit firsttherapeuticinrreached i.nonaaornonanona i.ageforttest i.af i.ttesttargetinr
                
                Iteration 0:   log likelihood = -97.068543  
                Iteration 1:   log likelihood = -85.364098  
                Iteration 2:   log likelihood = -84.413247  
                Iteration 3:   log likelihood = -84.409295  
                Iteration 4:   log likelihood = -84.409294  
                
                Logistic regression                             Number of obs     =        187
                                                                LR chi2(4)        =      25.32
                                                                Prob > chi2       =     0.0000
                Log likelihood = -84.409294                     Pseudo R2         =     0.1304
                
                --------------------------------------------------------------------------------------------
                firsttherapeuticinrreached |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                ---------------------------+----------------------------------------------------------------
                         1.nonaaornonanona |  -1.879392   .4819725    -3.90   0.000    -2.824041   -.9347431
                             1.ageforttest |   1.070471   .4649608     2.30   0.021     .1591643    1.981777
                                      1.af |  -1.051345   .4624124    -2.27   0.023    -1.957657   -.1450337
                          1.ttesttargetinr |   .8792999   .5607765     1.57   0.117    -.2198018    1.978402
                                     _cons |   1.388349   .2995205     4.64   0.000     .8012998    1.975398
                --------------------------------------------------------------------------------------------
                
                .
                Code:
                . mlogit firsttherapeuticinrreached i.nonaaornonanona i.ageforttest i.af i.ttesttargetinr
                
                Iteration 0:   log likelihood = -97.068543  
                Iteration 1:   log likelihood = -85.364098  
                Iteration 2:   log likelihood = -84.413247  
                Iteration 3:   log likelihood = -84.409295  
                Iteration 4:   log likelihood = -84.409294  
                
                Multinomial logistic regression                 Number of obs     =        187
                                                                LR chi2(4)        =      25.32
                                                                Prob > chi2       =     0.0000
                Log likelihood = -84.409294                     Pseudo R2         =     0.1304
                
                -----------------------------------------------------------------------------------
                firsttherapeuti~d |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                ------------------+----------------------------------------------------------------
                0                 |
                1.nonaaornonanona |   1.879392   .4819725     3.90   0.000     .9347431    2.824041
                    1.ageforttest |  -1.070471   .4649608    -2.30   0.021    -1.981777   -.1591643
                             1.af |   1.051345   .4624124     2.27   0.023     .1450337    1.957657
                 1.ttesttargetinr |  -.8792999   .5607765    -1.57   0.117    -1.978402    .2198018
                            _cons |  -1.388349   .2995205    -4.64   0.000    -1.975398   -.8012998
                ------------------+----------------------------------------------------------------
                1                 |  (base outcome)
                -----------------------------------------------------------------------------------
                
                .
                Code:
                . mlogit firsttherapeuticinrreached i.nonaaornonanona i.ageforttest i.af i.ttesttargetinr, rrr
                
                Iteration 0:   log likelihood = -97.068543  
                Iteration 1:   log likelihood = -85.364098  
                Iteration 2:   log likelihood = -84.413247  
                Iteration 3:   log likelihood = -84.409295  
                Iteration 4:   log likelihood = -84.409294  
                
                Multinomial logistic regression                 Number of obs     =        187
                                                                LR chi2(4)        =      25.32
                                                                Prob > chi2       =     0.0000
                Log likelihood = -84.409294                     Pseudo R2         =     0.1304
                
                -----------------------------------------------------------------------------------
                firsttherapeuti~d |        RRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
                ------------------+----------------------------------------------------------------
                0                 |
                1.nonaaornonanona |   6.549521   3.156689     3.90   0.000     2.546559    16.84478
                    1.ageforttest |   .3428471   .1594105    -2.30   0.021     .1378241    .8528562
                             1.af |   2.861498   1.323192     2.27   0.023     1.156079    7.082714
                 1.ttesttargetinr |   .4150734   .2327634    -1.57   0.117     .1382901     1.24583
                            _cons |   .2494868   .0747264    -4.64   0.000      .138706    .4487453
                ------------------+----------------------------------------------------------------
                1                 |  (base outcome)
                -----------------------------------------------------------------------------------
                
                .

                Comment


                • #9
                  However, it looks like that RRR by syntax -mlogit- = Odds ratio by syntax -logistic-

                  Note that 1/2.546559 = 0.3926867, and 1/16.84478 = 0.0593656. It's a same thing. However, we know that RRR and Odds ratio are not the same thing!

                  Code:
                  . logistic firsttherapeuticinrreached i.nonaaornonanona i.ageforttest i.af i.ttesttargetinr
                  
                  Logistic regression                             Number of obs     =        187
                                                                  LR chi2(4)        =      25.32
                                                                  Prob > chi2       =     0.0000
                  Log likelihood = -84.409294                     Pseudo R2         =     0.1304
                  
                  --------------------------------------------------------------------------------------------
                  firsttherapeuticinrreached | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
                  ---------------------------+----------------------------------------------------------------
                           1.nonaaornonanona |   .1526829    .073589    -3.90   0.000     .0593656    .3926867
                               1.ageforttest |   2.916752   1.356175     2.30   0.021     1.172531    7.255625
                                        1.af |   .3494673    .161598    -2.27   0.023     .1411888    .8649931
                            1.ttesttargetinr |   2.409212    1.35103     1.57   0.117     .8026778    7.231175
                                       _cons |   4.008227   1.200546     4.64   0.000     2.228436    7.209492
                  --------------------------------------------------------------------------------------------
                  
                  .

                  Comment


                  • #10
                    Code:
                    . mlogit firsttherapeuticinrreached i.nonaaornonanona i.ageforttest i.af i.ttesttargetinr, rrr b
                    > ase(0)
                    
                    Iteration 0:   log likelihood = -97.068543  
                    Iteration 1:   log likelihood = -85.364098  
                    Iteration 2:   log likelihood = -84.413247  
                    Iteration 3:   log likelihood = -84.409295  
                    Iteration 4:   log likelihood = -84.409294  
                    
                    Multinomial logistic regression                 Number of obs     =        187
                                                                    LR chi2(4)        =      25.32
                                                                    Prob > chi2       =     0.0000
                    Log likelihood = -84.409294                     Pseudo R2         =     0.1304
                    
                    -----------------------------------------------------------------------------------
                    firsttherapeuti~d |        RRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
                    ------------------+----------------------------------------------------------------
                    0                 |  (base outcome)
                    ------------------+----------------------------------------------------------------
                    1                 |
                    1.nonaaornonanona |   .1526829    .073589    -3.90   0.000     .0593656    .3926867
                        1.ageforttest |   2.916752   1.356175     2.30   0.021     1.172531    7.255625
                                 1.af |   .3494673    .161598    -2.27   0.023     .1411888    .8649931
                     1.ttesttargetinr |   2.409212    1.35103     1.57   0.117     .8026778    7.231175
                                _cons |   4.008227   1.200546     4.64   0.000     2.228436    7.209492
                    -----------------------------------------------------------------------------------
                    
                    .

                    Comment


                    • #11
                      Finally, I got to understand that, by logistic regress, to compute a confidence interval of relative risk ratio is not possible. However, fortunately, logistic regress could output a sample risk for each subgroup and its confidence interval. Also, by logistic regress itself, the absolute risk difference could also be gotten by Stata build-in syntax.

                      Thanks

                      Comment

                      Working...
                      X