Hello,

I am estimating, for example, the following double-difference / difference-in-difference logistic regression where opt_dum, depstat (Mild or None), and treat (HT or Con) are all binary variables.

The output of the model is as follows:
Code:
logit opt_dum i.depstat##i.treat, or 
Iteration 0:   log likelihood = -166.14693  
Iteration 1:   log likelihood = -121.37891  
Iteration 2:   log likelihood = -120.88007  
Iteration 3:   log likelihood = -120.87909  
Iteration 4:   log likelihood = -120.87909  

Logistic regression                             Number of obs     =        240
                                                LR chi2(3)        =      90.54
                                                Prob > chi2       =     0.0000
Log likelihood = -120.87909                     Pseudo R2         =     0.2725

-------------------------------------------------------------------------------
      opt_dum | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
      depstat |
        Mild  |   .3891403   .1851221    -1.98   0.047     .1531694    .9886448
              |
        treat |
          HT  |   19.15126   9.456233     5.98   0.000     7.276179    50.40706
              |
depstat#treat |
     Mild#HT  |   .5459965   .3697249    -0.89   0.372     .1448083    2.058668
              |
        _cons |   .3953488   .1132654    -3.24   0.001     .2254839     .693179
-------------------------------------------------------------------------------
I then use the margins command to obtain the marginal estimates
Code:
. margins i.depstat##i.treat, post coeflegend

Predictive margins                              Number of obs     =        240
Model VCE    : OIM

Expression   : Pr(opt_dum), predict()

-------------------------------------------------------------------------------
              |     Margin  Legend
--------------+----------------------------------------------------------------
      depstat |
         Non  |   .5833333  _b[1bn.depstat]
        Mild  |       .375  _b[2.depstat]
              |
        treat |
         Con  |   .2083333  _b[1bn.treat]
          HT  |        .75  _b[2.treat]
              |
depstat#treat |
     Non#Con  |   .2833333  _b[1bn.depstat#1bn.treat]
      Non#HT  |   .8833333  _b[1bn.depstat#2.treat]
    Mild#Con  |   .1333333  _b[2.depstat#1bn.treat]
     Mild#HT  |   .6166667  _b[2.depstat#2.treat]
-------------------------------------------------------------------------------
My question is whether the following lincom code is appropriate for testing the double difference i.e. to test whether the association between depstat and opt_dum varies by the treat variable
Code:
. lincom ( _b[2.depstat#2.treat]- _b[2.depstat#1bn.treat])-(_b[1bn.depstat#2.treat]-_b[1bn.depstat#1bn.treat])

 ( 1)  1bn.depstat#1bn.treat - 1bn.depstat#2.treat - 2.depstat#1bn.treat + 2.depstat#2.treat = 0

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.1166667   .1047263    -1.11   0.265    -.3219264    .0885931
------------------------------------------------------------------------------
Thank you,
Caroline