Dear Stata Folk

Here is some background on what I am doing. I'm conducting an event history analysis of state gun laws with the observation period starting in 1981 and ending in 2016. States at "risk" of adopting a gun law are coded as "0" and then "1" when the law is adopted. States exit the sample upon adopting a gun law as I am currently thinking of this risk as a non-repeated event. All observations are at the state-year level so these data are discrete. I had been examining these data with logistic regression models and using some variables to model the duration dependence, however I am not really interested in baseline hazard rate and would be comfortable arguing that it is a "nuisance" as Box-Steffensmeier and Jones (2004) conceive of it. Also, it seems likely that some states are more likely to adopt a gun law than others based on time-invariant traits (e.g. Texas probably won't pass a gun law, but New York might be more likely), so the use of fixed effects in a conditional logistic model to address unobserved heterogeneity seems ideal. Since I am willing to argue that the baseline hazard rate is a nuisance the conditional logit model is also appealing because it doesn't require that duration dependence be specified (my understanding of this is based on Box-Steffensmeier and Jones discussion (2004:80-81)).

I also understand the conditional logit model replicates results from a Cox model using an exact partial-likelihood method to handle tied failures. Cleves et al. (2010) Stata book is helpful in demonstrating that using this syntax and example data they provide on page 197.

Code:
use http://www.stata-press.com/data/cggm3/hip2, clear
stsplit, at(failures) riskset(riskid)
stcox age protect, exactp nohr
clogit _d age protect, group(riskid)
The Cleves et al example gives results from stcox and clogit that are identical (although the sample sizes are different based on what I think is missing data in the riskid variable created from stsplit.)

The issue I am having is that stcox and clogit are not producing similar results with my data though. My results between stcox and clogit are markedly different. Interestingly, stcox does produce coefficients similar to the earlier logit models with duration dependence modeled, while clogit again produces coefficients much different than the logit results.

Here is an example of syntax for how I set up the data and ran the models.

Code:
stset year, id(fips) origin(time 1981) failure(ccw) exit(failure)
gen duration = _t
gen dur2 = (dur*dur)

logit  _d percap_security vc_tot_rate citi6016  nra_prct durat dur2,                       
clogit _d percap_security vc_tot_rate citi6016  nra_prct , group(fips)
stcox     percap_security vc_tot_rate citi6016  nra_prct , exactp nohr
And here is the output from that syntax

Code:
. stset year, id(fips) origin(time 1981) failure(ccw) exit(failure)

                id:  fips
     failure event:  ccw != 0 & ccw < .
obs. time interval:  (year[_n-1], year]
 exit on or before:  failure
    t for analysis:  (time-origin)
            origin:  time 1981

------------------------------------------------------------------------------
       1850  total observations
         50  observations end on or before enter()
        914  observations begin on or after (first) failure
------------------------------------------------------------------------------
        886  observations remaining, representing
         45  subjects
         36  failures in single-failure-per-subject data
        886  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =        36

. gen duration = _t
(964 missing values generated)

. gen dur2 = (dur*dur)
(964 missing values generated)

. 
. logit  _d percap_security vc_tot_rate citi6016  nra_prct durat dur2,                          
>           

Iteration 0:   log likelihood = -150.19836  
Iteration 1:   log likelihood = -132.14685  
Iteration 2:   log likelihood = -122.07189  
Iteration 3:   log likelihood = -121.91509  
Iteration 4:   log likelihood = -121.91494  
Iteration 5:   log likelihood = -121.91494  

Logistic regression                             Number of obs     =        877
                                                LR chi2(6)        =      56.57
                                                Prob > chi2       =     0.0000
Log likelihood = -121.91494                     Pseudo R2         =     0.1883

---------------------------------------------------------------------------------
             _d |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
percap_security |  -.0056228   .0021747    -2.59   0.010    -.0098851   -.0013604
    vc_tot_rate |   .0019578   .0010813     1.81   0.070    -.0001615     .004077
       citi6016 |  -.0443306   .0164504    -2.69   0.007    -.0765729   -.0120883
       nra_prct |   1.356273   .3351823     4.05   0.000     .6993281    2.013218
       duration |   .3266673   .0962797     3.39   0.001     .1379625    .5153721
           dur2 |  -.0046642   .0026596    -1.75   0.079    -.0098769    .0005485
          _cons |  -4.961659   1.295064    -3.83   0.000    -7.499937    -2.42338
---------------------------------------------------------------------------------

. clogit _d percap_security vc_tot_rate citi6016  nra_prct , group(fips)
note: 9 groups (315 obs) dropped because of all positive or
      all negative outcomes.

Iteration 0:   log likelihood = -87.359195  
Iteration 1:   log likelihood = -63.752914  
Iteration 2:   log likelihood =  -63.23594  
Iteration 3:   log likelihood = -63.233311  
Iteration 4:   log likelihood =  -63.23331  

Conditional (fixed-effects) logistic regression

                                                Number of obs     =        562
                                                LR chi2(4)        =      61.53
                                                Prob > chi2       =     0.0000
Log likelihood =  -63.23331                     Pseudo R2         =     0.3273

---------------------------------------------------------------------------------
             _d |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
percap_security |   .0340598   .0067303     5.06   0.000     .0208686     .047251
    vc_tot_rate |   .0054414   .0035358     1.54   0.124    -.0014886    .0123714
       citi6016 |  -.1046982   .0401338    -2.61   0.009     -.183359   -.0260374
       nra_prct |   .7620772   1.028495     0.74   0.459    -1.253736    2.777891
---------------------------------------------------------------------------------

. stcox     percap_security vc_tot_rate citi6016  nra_prct , exactp nohr

         failure _d:  ccw
   analysis time _t:  (year-origin)
             origin:  time 1981
                 id:  fips

Iteration 0:   log likelihood = -97.212961
Iteration 1:   log likelihood = -79.971062
Iteration 2:   log likelihood = -79.106013
Iteration 3:   log likelihood = -79.103243
Iteration 4:   log likelihood = -79.103243
Refining estimates:
Iteration 0:   log likelihood = -79.103243

Cox regression -- exact partial likelihood

No. of subjects =           45                  Number of obs    =         877
No. of failures =           36
Time at risk    =          877
                                                LR chi2(4)       =       36.22
Log likelihood  =   -79.103243                  Prob > chi2      =      0.0000

---------------------------------------------------------------------------------
             _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
percap_security |  -.0051768    .002292    -2.26   0.024    -.0096691   -.0006846
    vc_tot_rate |   .0015937   .0012277     1.30   0.194    -.0008125    .0039999
       citi6016 |  -.0363766    .017078    -2.13   0.033    -.0698489   -.0029044
       nra_prct |   1.377141   .3927354     3.51   0.000     .6073938    2.146888
---------------------------------------------------------------------------------
From what I can tell here, I have 9 states that are at risk for a gun law but never experience failure which makes them right censored. stcox will estimate this model and include those right censored states in the model, logit will do the same . However, clogit drops those 9 states from model (which I have confirmed by diving into the data and comparing the sample sizes). At first, clogit dropping these states seemed sensible to me as there is no variation in the dependent variable and most commands with fixed effects in Stata will exclude observations that do not vary over time. But this doesn't seem to be an issue that arises in the Cleves et al. (2010) example. So I am confused as to why clogit seems to be doing this for my data but not the Cleves et al example.

Still, I suspected that the differences in results from stcox and clogit might have been due to the dropping of the 9 right censored states. However when I remove those states and make stcox and clogit use the same cases the results still remain very different between the two models. To show that, here are the results from stcox using the exact same observations as clogit reported above where I removed the 9 right censored states.

Code:
. stcox     percap_security vc_tot_rate citi6016  nra_prct , exactp nohr

         failure _d:  ccw
   analysis time _t:  (year-origin)
             origin:  time 1981
                 id:  fips

Iteration 0:   log likelihood =  -76.61055
Iteration 1:   log likelihood = -73.002967
Iteration 2:   log likelihood = -72.598409
Iteration 3:   log likelihood = -72.598181
Refining estimates:
Iteration 0:   log likelihood = -72.598181

Cox regression -- exact partial likelihood

No. of subjects =           36                  Number of obs    =         562
No. of failures =           36
Time at risk    =          562
                                                LR chi2(4)       =        8.02
Log likelihood  =   -72.598181                  Prob > chi2      =      0.0907

---------------------------------------------------------------------------------
             _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
percap_security |  -.0030332   .0023098    -1.31   0.189    -.0075604     .001494
    vc_tot_rate |   .0010864   .0012259     0.89   0.375    -.0013162    .0034891
       citi6016 |  -.0090561   .0199809    -0.45   0.650     -.048218    .0301058
       nra_prct |   1.077003   .4119803     2.61   0.009     .2695368     1.88447
---------------------------------------------------------------------------------
This leads me to my reason for posting here and the following questions I hope someone can help me with.
  1. Why does clogit drop the right censored states from my analysis but doesn't seem to be doing the same for right censored subjects in the Cleve et al (2010) example?
  2. Why are the results from stcox and clogit different when they should be identical? I don't think it can be due to the dropping of the right censored states because even when I exclude those states the results are still different between the two models.
  3. In the end, should I just use stcox and avoid all this headache?
Thanks for any help here.


I am also providing some data courtesy of dataex to help illustrate the data structure.


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str2 state float(fips year ccw) byte(approval _st _d _t _t0) double percap_security float vc_tot_rate double citi6016 float nra_prct
"AL" 1 1981 . 1 0 .  .  . 179.55928959823714  470.1507  26.89806365966797  .3664511
"AL" 1 1982 0 1 1 0  1  0 195.11822820214584  449.7275 23.276649475097656  .8888952
"AL" 1 1983 0 1 1 0  2  1 194.65031323363138  418.6724  35.09223175048828 1.0048926
"AL" 1 1984 0 1 1 0  3  2 194.15476578039267  435.3437 28.214889526367188 1.1073632
"AL" 1 1985 0 1 1 0  4  3 215.14490179527562  463.1314 27.877220153808594 1.1100628
"AL" 1 1986 0 1 1 0  5  4 227.58137670489575 566.59424  37.79115676879883  .9797651
"AL" 1 1987 0 1 1 0  6  5 227.34193379222114   568.655  38.51693344116211  .9684046
"AL" 1 1988 0 1 1 0  7  6  234.7806343715425   572.885  45.02992630004883  .9735094
"AL" 1 1989 0 1 1 0  8  7 248.95920736398998   603.664  37.47248458862305  .9703684
"AL" 1 1990 0 1 1 0  9  8 239.95386442240758   706.904 33.835350036621094  .8807781
"AL" 1 1991 0 1 1 0 10  9 255.18451486844228  842.0758 39.809078216552734  .7961761
"AL" 1 1992 0 1 1 0 11 10  268.9725055001031  867.8834  39.62211990356445  .8630447
"AL" 1 1993 0 1 1 0 12 11  262.9291872211458  775.3781  39.01713943481445   1.04957
"AL" 1 1994 0 1 1 0 13 12   286.323585409847  677.0528  39.41495132446289 1.1492223
"AL" 1 1995 0 1 1 0 14 13  287.8688449505387  625.9077  33.42988204956055 1.0331409
"AL" 1 1996 0 1 1 0 15 14  289.7828658934405  557.8026 29.399242401123047  .8534433
"AL" 1 1997 0 1 1 0 16 15  296.0398844463401  558.1356  36.02786636352539  .7568679
"AL" 1 1998 0 1 1 0 17 16  322.7246341710451  505.9594  41.35292053222656  .7424908
"AL" 1 1999 0 1 1 0 18 17 342.83377107101506  483.5286  43.83360290527344  .8162381
"AL" 1 2000 0 1 1 0 19 18 331.91041243949223  485.6056  32.09574890136719 1.0323498
"AL" 1 2001 0 1 1 0 20 19 340.17303201498294  438.3081  34.73192596435547 1.1872392
"AL" 1 2002 0 1 1 0 21 20 348.61241166067396 444.87955 33.778839111328125 1.0379369
"AL" 1 2003 0 1 1 0 22 21 365.84233725139484  429.2448  28.70806121826172  .9775305
"AL" 1 2004 0 1 1 0 23 22   382.569938682459  426.5097  39.14337921142578  .8746606
"AL" 1 2005 0 1 1 0 24 23 379.04406086652654  430.6092    40.318115234375  .8603868
"AL" 1 2006 0 1 1 0 25 24  398.4043358739285   422.404 40.314231872558594  .8057065
"AL" 1 2007 0 1 1 0 26 25 432.75926724836376 444.59045  47.25582504272461  .8174793
"AL" 1 2008 0 1 1 0 27 26  414.5888521836894  447.4158 48.369239807128906  .8515525
"AL" 1 2009 0 1 1 0 28 27 449.94581070778327  445.4451  27.26303482055664  1.092511
"AL" 1 2010 0 1 1 0 29 28 433.67170898040075  383.7223 19.252901077270508  1.245337
"AL" 1 2011 0 1 1 0 30 29 418.88092592514244  420.1322 36.038509368896484 1.1542593
"AL" 1 2012 0 1 1 0 31 30   405.424905251381  450.4398  37.59914016723633 1.0512546
"AL" 1 2013 1 2 1 1 32 31 401.96881889331434  431.3923   35.8233757019043   1.25967
"AL" 1 2014 . 2 0 .  .  .  400.2527010033682  427.9596  33.77626037597656 1.2287192
"AL" 1 2015 . 2 0 .  .  . 415.94705129750974  472.8593  34.95671081542969 1.1562823
"AL" 1 2016 . 2 0 .  .  .  405.8024386733288 532.27234  38.24081802368164 1.2784117
"AL" 1 2017 . 2 0 .  .  .                  .         .                  .         .
"AK" 2 1981 . 0 0 .  .  .  688.7242712209394  606.2257  34.38278579711914  1.848188
"AK" 2 1982 0 0 1 0  1  0   977.448034282681  607.6431 37.208778381347656 3.8227916
"AK" 2 1983 0 0 1 0  2  1  935.7229474416222 601.94464  44.55486297607422 3.8474295
"AK" 2 1984 0 0 1 0  3  2  900.7360496744552    605.02  46.16183853149414 4.0021257
"AK" 2 1985 0 0 1 0  4  3 1071.8712912359022  569.2072  44.40671157836914  3.902196
"AK" 2 1986 0 0 1 0  5  4  863.7098149383427 559.65076 50.812137603759766  3.377656
"AK" 2 1987 0 0 1 0  6  5  789.9109465449525  443.3451  54.29391860961914 3.2636206
"AK" 2 1988 0 0 1 0  7  6  754.3215939679009  494.8495  52.98939895629883  3.243552
"AK" 2 1989 0 0 1 0  8  7   786.301426082275  479.3853   46.0724983215332 3.3197846
"AK" 2 1990 0 0 1 0  9  8  738.9885369359636  521.4264   54.8084831237793  3.319055
"AK" 2 1991 0 0 1 0 10  9  748.4290974276894  613.6519 48.720062255859375  3.140077
"AK" 2 1992 0 0 1 0 11 10  747.8224610639909  658.5295  52.37739562988281  3.360759
"AK" 2 1993 0 0 1 0 12 11  746.9655444074463  760.2197  51.26310729980469  3.948238
"AK" 2 1994 1 2 1 1 13 12  759.0412192601236  769.7561  39.82509231567383   4.19222
"AK" 2 1995 . 2 0 .  .  .  760.4228477825534  770.3354 29.933387756347656 3.9635215
"AK" 2 1996 . 2 0 .  .  .   735.800178505263   725.801 36.719764709472656  3.430835
"AK" 2 1997 . 2 0 .  .  .  735.1728818764277  696.6106 31.454334259033203  3.222925
"AK" 2 1998 . 2 0 .  .  .   761.221070538802  647.6517  35.84738540649414  3.128488
"AK" 2 1999 . 2 0 .  .  .  766.0112744913995  625.5012  32.42792892456055  3.206574
"AK" 2 2000 . 2 0 .  .  .  781.1802576481297  565.9569 21.373126983642578 3.4431965
"AK" 2 2001 . 2 0 .  .  .  849.7170704066492 589.38257 28.044511795043945  4.132148
"AK" 2 2002 . 2 0 .  .  .  912.9209573446122 564.65686  30.40620994567871 3.8067245
"AK" 2 2003 . 4 0 .  .  .  810.4635553829723  597.9205 36.411495208740234  3.694939
"AK" 2 2004 . 4 0 .  .  .   704.745622722647   630.834 42.309547424316406 3.3472574
"AK" 2 2005 . 4 0 .  .  .  745.6761446523008  628.8365 39.078208923339844  3.286998
"AK" 2 2006 . 4 0 .  .  .   753.090652095617  682.6575  43.80061721801758  3.058632
"AK" 2 2007 . 4 0 .  .  .  810.3199792511057  664.4128  59.03574752807617  3.056078
"AK" 2 2008 . 4 0 .  .  .  828.2100076979432  650.9517  66.86994171142578  2.972413
"AK" 2 2009 . 4 0 .  .  .  905.0258064040776  632.9992   64.2382583618164 3.1023974
"AK" 2 2010 . 4 0 .  .  .  932.2813070579488  635.4066  50.97918701171875  2.954424
"AK" 2 2011 . 4 0 .  .  .   905.326719335112  611.0309 55.232513427734375  2.609819
"AK" 2 2012 . 4 0 .  .  .  946.0160014023734  603.4833  53.82363510131836  2.277493
"AK" 2 2013 . 4 0 .  .  .  1004.127557615089  639.0466  59.57862854003906  2.533252
"AK" 2 2014 . 4 0 .  .  .  984.1913005079645   635.804  51.32193374633789  2.545727
"AK" 2 2015 . 4 0 .  .  . 1021.2380619491543  730.9115 50.526309967041016   2.44568
"AK" 2 2016 . 4 0 .  .  .  955.3615476065314   804.158 50.632511138916016  2.470569
"AK" 2 2017 . 4 0 .  .  .                  .         .                  .         .
"AZ" 4 1981 . 0 0 .  .  . 372.38760164663347  572.2914 23.926250457763672  .6021123
"AZ" 4 1982 0 0 1 0  1  0 391.65491214931103  511.6163 28.961925506591797  1.302156
"AZ" 4 1983 0 0 1 0  2  1 380.91732803298856  493.1751   38.6386833190918 1.3855015
"AZ" 4 1984 0 0 1 0  3  2  385.9358112906259 513.70416  41.09173583984375 1.4478332
"AZ" 4 1985 0 0 1 0  4  3  400.2040181882723  603.1654  33.11199951171875 1.4276726
"AZ" 4 1986 0 0 1 0  5  4  461.2746722399718  660.0142 35.244232177734375 1.2696546
"AZ" 4 1987 0 0 1 0  6  5 479.28202678758566  603.4733   38.0020866394043  1.217057
"AZ" 4 1988 0 0 1 0  7  6  478.6731961499219  598.1868  37.73720169067383 1.2282108
"AZ" 4 1989 0 0 1 0  8  7 488.21430736058653 588.59503  37.22602844238281  1.222646
"AZ" 4 1990 0 0 1 0  9  8  506.5008887841264  649.0328  38.65205383300781 1.1583707
"AZ" 4 1991 0 0 1 0 10  9  505.7266195156828  663.8906  35.66222381591797 1.0605172
"AZ" 4 1992 0 0 1 0 11 10   489.946399226796  656.4787  43.20975875854492 1.1623728
"AZ" 4 1993 0 0 1 0 12 11  446.7442145880539  692.2252  39.20719528198242  1.336682
"AZ" 4 1994 1 2 1 1 13 12 451.37351234878486  674.9682  33.25286102294922 1.2412814
"AZ" 4 1995 . 2 0 .  .  . 452.68653151339106  678.9623  40.25646209716797 1.3057194
"AZ" 4 1996 . 2 0 .  .  . 456.72676800291634 609.62213 36.167476654052734 1.1140107
"AZ" 4 1997 . 2 0 .  .  .  496.1408797827791 599.76904 42.391178131103516  .9812033
"AZ" 4 1998 . 2 0 .  .  .  541.6380398567296  552.5724  43.53239440917969  .9636126
"AZ" 4 1999 . 2 0 .  .  .  540.5668491358341  524.1825 40.110721588134766  1.079855
"AZ" 4 2000 . 2 0 .  .  .  553.9694120893225 528.64154  40.23054122924805  1.287441
"AZ" 4 2001 . 2 0 .  .  .  572.2312146423296  543.7589 42.843685150146484  1.389387
"AZ" 4 2002 . 2 0 .  .  .   588.647034978963    559.11 43.815311431884766 1.2208652
"AZ" 4 2003 . 2 0 .  .  .  585.6613814189861  519.7116  46.84286117553711 1.1264774
"AZ" 4 2004 . 2 0 .  .  .  579.9170191979413 512.20685 47.750816345214844 1.0200881
"AZ" 4 2005 . 2 0 .  .  .  599.9862829656169 521.96606 46.694358825683594 1.0028468
"AZ" 4 2006 . 2 0 .  .  .  616.2300709969849  554.9049  50.14946365356445  .9573171
end