Announcement

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

  • Lincom after gologit2

    Using Stata 15.1 I have estimated a generalised ordered logit using the gologit2 command, with the coefficients expressed as odds ratios. I am interested in looking at whether single changes in an interacted 3-way factor variable are statistically significant. The full regression output is huge so I just include a small example below that follows on to my lincom example

    Code:
                           ordered_salary | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------------------------------+----------------------------------------------------------------
    1                                    |
    x1#x2#x3 |
    
                                  2 1 1  |    1.25474    .098736     2.88   0.004     1.075406     1.46398
                                  3 1 1  |   1.457048    .199831     2.74   0.006     1.113611    1.906402
    I am trying to using the lincom command to examine the odds ratios and calculate whether or not the difference between them is statistically significant

    The command I enter is

    Code:
    lincom [1]3.x1#1.x2#1.x3 - [1]2.x1#1.x2#1.x3, or
    The [1] specifies that I am estimating this difference using the odds ratios from the first equation of the gologit. This is what I have used before with linear regressions and single equation regressions and it usually provides me with the correctly calculated difference and whether or not the difference is statistically significant. The output I get is


    Code:
    ------------------------------------------------------------------------------
    ordered_wa~s | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             (1) |   1.161235   .1714028     1.01   0.311       .86952    1.550818
    ------------------------------------------------------------------------------
    I may be missing something but this doesn't look correct to me. The difference between the odds ratios isn't correct (subtracting the two from each other should give, 0.202308). I don't know where the 1.616235 is coming from. Is there any way to see the working behind the calculation, i.e. which coefficients it subtracted to yield this result. I also noticed that when I try and use the lincom command to estimate differences in the odds ratios from other equations within the the gologit (i.e. equation 2), the number highlighted in bold within my lincom output listed above does not change to 2. Is this also an issue?

    Any guidance in either what I am missing or what I am doing wrong would be really appreciated.

  • #2
    gologit is from SSC (FAQ Advice #12), but is not crucial here in answering your question. Most commands do not store the odds ratios (ORs), but rather just display them. What is stored is the coefficient, where the ORs are exponentiated coefficients. That being the case, if you want to combine exponentiated coefficients, use nlcom as you are no longer in the linear realm.

    Code:
    sysuse auto, clear
    set seed 09052022
    gen rvar= runiformint(1,4)
    logit foreign price c.mpg##i.rvar, or
    display exp(_b[3.rvar#c.mpg])
    display exp(_b[2.rvar#c.mpg])
    display exp(_b[3.rvar#c.mpg])- exp(_b[2.rvar#c.mpg])
    nlcom exp(_b[3.rvar#c.mpg])- exp(_b[2.rvar#c.mpg])

    Res.:

    Code:
    . logit foreign price c.mpg##i.rvar, or
    
    Iteration 0:   log likelihood =  -45.03321  
    Iteration 1:   log likelihood = -28.262866  
    Iteration 2:   log likelihood = -27.410571  
    Iteration 3:   log likelihood = -27.380806  
    Iteration 4:   log likelihood = -27.380773  
    Iteration 5:   log likelihood = -27.380773  
    
    Logistic regression                             Number of obs     =         74
                                                    LR chi2(8)        =      35.30
                                                    Prob > chi2       =     0.0000
    Log likelihood = -27.380773                     Pseudo R2         =     0.3920
    
    ------------------------------------------------------------------------------
         foreign | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           price |   1.000452   .0001552     2.91   0.004     1.000148    1.000757
             mpg |   1.949944   .4522811     2.88   0.004     1.237626    3.072236
                 |
            rvar |
              2  |   3.140228   17.24894     0.21   0.835     .0000663    148771.6
              3  |   592.3199   2927.597     1.29   0.196     .0367631     9543354
              4  |   2677.781   15720.15     1.34   0.179       .02696    2.66e+08
                 |
      rvar#c.mpg |
              2  |   .8124381   .2060409    -0.82   0.413     .4942181    1.335555
              3  |   .6354434   .1513189    -1.90   0.057     .3984549    1.013385
              4  |   .6415213   .1879869    -1.51   0.130     .3612275    1.139308
                 |
           _cons |   9.96e-08   5.07e-07    -3.17   0.002     4.61e-12    .0021521
    ------------------------------------------------------------------------------
    Note: _cons estimates baseline odds.
    
    
    . display exp(_b[3.rvar#c.mpg])
    .6354434
    
    .
    . display exp(_b[2.rvar#c.mpg])
    .81243808
    
    .
    . display exp(_b[3.rvar#c.mpg])- exp(_b[2.rvar#c.mpg])
    -.17699468
    
    .
    . nlcom exp(_b[3.rvar#c.mpg])- exp(_b[2.rvar#c.mpg])
    
           _nl_1: exp(_b[3.rvar#c.mpg])- exp(_b[2.rvar#c.mpg])
    
    ------------------------------------------------------------------------------
         foreign | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           _nl_1 |  -.1769947   .1512907    -1.17   0.242    -.4735189    .1195296
    ------------------------------------------------------------------------------
    Last edited by Andrew Musau; 05 Sep 2022, 12:56.

    Comment


    • #3
      FYI, Stata did do the original calculation correctly. As Andrew notes, it was using the coefficients, not the exponentiated coefficients:

      Code:
      . di ln(1.457048) - ln(1.25474)
      .14948409
      
      . di exp(ln(1.457048) - ln(1.25474))
      1.161235
      I am the author of gologit2, but as Andrew says, this isn't some sort of problem that is specific to gologit2. You just have to set the tests up right.

      I will say that, unless I had some really phenomenal theory, I probably wouldn't be testing whether two three-way interactions were equal. I'd also be worried that if there are huge numbers of such terms some contrasts could come up significant by chance alone. But maybe your theory is strong enough to justify doing such tests.
      -------------------------------------------
      Richard Williams
      Professor Emeritus of Sociology
      University of Notre Dame
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://academicweb.nd.edu/~rwilliam/

      Comment

      Working...
      X