Announcement

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

  • Heckman probit (heckprobit) with fixed effects; observations omitted and not used but same number of observations

    Hi, I am analyzing different stages of conflict between states. Each episode has an attacking and an attacked state. My dependent variable (DV) is whether the attacking state gets what it wants (Success=1). I am running a heckprobit model to account for different escalation stages of conflict. In one version of my model, I added fixed effects (FEs) for the attacked state to account for its time-invariant characteristics.

    My code looks like this:

    Code:
    heckprobit Success x y i.attackedstate, select(StageTwo= x y c.DurationToStageTwo##c.DurationToStageTwo##c.DurationToStageTwo i.attackedstate) vce(robust)

    The dataset does not include successful and unsuccessful attacks for each attacked state. In other words, in several cases, there is no variation in the DV for the FE units. As a result, STATA 17.0 SE tells me:

    Code:
    note: 94.attackedtstate != 0 predicts failure perfectly;
          94.attackedstate omitted and 3 obs not used.

    Even though STATA tells me that it omits and drops several observations when I add the FEs (which makes sense), the number of observations does not change. In other words, STATA tells me it drops observations but doesn't seem actually to do so. How come? I also noticed that STATA no longer computes the Wald chi2 value when I add the FEs. Does this suggest there may be a problem?

    Thank you very much for your help!

  • #2
    Hans:
    welcome to this forum.
    As per FAQ, could you please share what Stata gave you back, too? Thanks.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo, Thank you very much for your quick reply. This is with the FEs (I deleted some FE dummies to stay within the character limit):

      Code:
      . heckprobit Success X Y i.attackedstate, select(StageTwo= X Y c.DurationToStageTwo##c.DurationT
      > oStageTwo##c.DurationToStageTwo i.attackedstate) vce(robust)
      
      Fitting probit model:
      
      note: 40.attackedstate != 0 predicts failure perfectly;
            40.attackedstate omitted and 1 obs not used.
      
      note: 52.attackedstate != 0 predicts failure perfectly;
            52.attackedstate omitted and 1 obs not used.
      
      note: 53.attackedstate != 0 predicts failure perfectly;
            53.attackedstate omitted and 1 obs not used.
      
      note: 54.attackedstate != 0 predicts success perfectly;
            54.attackedstate omitted and 1 obs not used.
      
      note: 57.attackedstate != 0 predicts failure perfectly;
            57.attackedstate omitted and 1 obs not used.
      
      note: 58.attackedstate != 0 predicts success perfectly;
            58.attackedstate omitted and 1 obs not used.
      
      note: 70.attackedstate != 0 predicts failure perfectly;
            70.attackedstate omitted and 8 obs not used.
      
      note: 91.attackedstate != 0 predicts failure perfectly;
            91.attackedstate omitted and 2 obs not used.
      
      note: 94.attackedstate != 0 predicts failure perfectly;
            94.attackedstate omitted and 3 obs not used.
      
      note: 101.attackedstate != 0 predicts failure perfectly;
            101.attackedstate omitted and 3 obs not used.
      
      note: 130.attackedstate != 0 predicts failure perfectly;
            130.attackedstate omitted and 5 obs not used.
      
      note: 135.attackedstate != 0 predicts failure perfectly;
            135.attackedstate omitted and 3 obs not used.
      
      note: 140.attackedstate != 0 predicts failure perfectly;
            140.attackedstate omitted and 3 obs not used.
      
      note: 150.attackedstate != 0 predicts failure perfectly;
            150.attackedstate omitted and 1 obs not used.
      
      note: 155.attackedstate != 0 predicts failure perfectly;
            155.attackedstate omitted and 3 obs not used.
      
      note: 165.attackedstate != 0 predicts failure perfectly;
            165.attackedstate omitted and 2 obs not used.
      
      note: 205.attackedstate != 0 predicts failure perfectly;
            205.attackedstate omitted and 2 obs not used.
      
      note: 255.attackedstate != 0 predicts failure perfectly;
            255.attackedstate omitted and 2 obs not used.
      
      note: 265.attackedstate != 0 predicts failure perfectly;
            265.attackedstate omitted and 4 obs not used.
      
      note: 315.attackedstate != 0 predicts success perfectly;
            315.attackedstate omitted and 3 obs not used.
      
      note: 317.attackedstate != 0 predicts failure perfectly;
            317.attackedstate omitted and 1 obs not used.
      
      note: 338.attackedstate != 0 predicts failure perfectly;
            338.attackedstate omitted and 1 obs not used.
      
      note: 344.attackedstate != 0 predicts failure perfectly;
            344.attackedstate omitted and 1 obs not used.
      
      
      
      Iteration 0:   log pseudolikelihood = -266.32839  
      Iteration 1:   log pseudolikelihood = -227.89891  
      Iteration 2:   log pseudolikelihood = -227.67131  
      Iteration 3:   log pseudolikelihood = -227.67109  
      Iteration 4:   log pseudolikelihood = -227.67109  
      
      Fitting selection model:
      
      Iteration 0:   log pseudolikelihood = -714.76771  
      Iteration 1:   log pseudolikelihood =  -529.1996  
      Iteration 2:   log pseudolikelihood = -519.22624  
      Iteration 3:   log pseudolikelihood = -517.49253  
      Iteration 4:   log pseudolikelihood = -516.38004  
      Iteration 5:   log pseudolikelihood = -516.22201  
      Iteration 6:   log pseudolikelihood = -516.21696  
      Iteration 7:   log pseudolikelihood = -516.21597  
      Iteration 8:   log pseudolikelihood = -516.21579  
      Iteration 9:   log pseudolikelihood = -516.21577  
      
      Fitting starting values:
      
      Iteration 0:   log pseudolikelihood = -369.44745  
      Iteration 1:   log pseudolikelihood = -235.96167  
      Iteration 2:   log pseudolikelihood = -228.90625  
      Iteration 3:   log pseudolikelihood = -227.83418  
      Iteration 4:   log pseudolikelihood = -227.65638  
      Iteration 5:   log pseudolikelihood = -227.62285  
      Iteration 6:   log pseudolikelihood = -227.61595  
      Iteration 7:   log pseudolikelihood = -227.61487  
      Iteration 8:   log pseudolikelihood = -227.61471  
      Iteration 9:   log pseudolikelihood = -227.61467  
      Iteration 10:  log pseudolikelihood = -227.61467  
      
      Fitting full model:
      
      Iteration 0:   log pseudolikelihood = -743.83159  
      Iteration 1:   log pseudolikelihood = -743.82383  
      Iteration 2:   log pseudolikelihood = -743.82383  
      
      Probit model with sample selection              Number of obs     =      1,032
                                                            Selected    =        533
                                                            Nonselected =        499
      
                                                      Wald chi2(113)    =          .
      Log pseudolikelihood = -743.8238                Prob > chi2       =          .
      
      --------------------------------------------------------------------------------------------------------------------------------------
                                                                           |               Robust
                                                                           | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      ---------------------------------------------------------------------+----------------------------------------------------------------
      Success                                                              |
                                                 X |   .6330494    .196741     3.22   0.001     .2474442    1.018655
                                                               Y |   1.016068   .1920074     5.29   0.000       .63974    1.392395
                                                                           |
                                                               attackedstate |
                                                                       20  |  -.3108194   .4251915    -0.73   0.465    -1.144179    .5225405
                                                                       40  |  -6.310438   .3571373   -17.67   0.000    -7.010414   -5.610462
                                                                       41  |   .2432625   .7460565     0.33   0.744    -1.218981    1.705506
                                                                       42  |  -.5047965   .7897199    -0.64   0.523    -2.052619    1.043026
                                                                       52  |  -6.013102   .4619937   -13.02   0.000    -6.918593   -5.107611
                                                                       53  |  -5.924661   .3901878   -15.18   0.000    -6.689415   -5.159907
                                                                       54  |   6.381297   .3878351    16.45   0.000     5.621154    7.141439
                                                                       57  |  -5.924661   .3901878   -15.18   0.000    -6.689415   -5.159907
                                                                       58  |   6.381297   .3878351    16.45   0.000     5.621154    7.141439
                                                                       70  |   -5.95616   .3258173   -18.28   0.000     -6.59475   -5.317569
                                                                       90  |    1.04275   .8606146     1.21   0.226    -.6440238    2.729523
                                                                       91  |  -6.132854   .4398468   -13.94   0.000    -6.994938    -5.27077
                                                                       92  |   .0332477   .8568049     0.04   0.969    -1.646059    1.712554
                                                                       93  |   .0661995   .6518433     0.10   0.919     -1.21139    1.343789
                                                                       94  |  -6.163469   .3362956   -18.33   0.000    -6.822596   -5.504342
                                                                       95  |    .654819   .6809809     0.96   0.336     -.679879    1.989517
                                                                      100  |  -.2980448   .7459759    -0.40   0.689    -1.760131    1.164041
                                                                      101  |  -6.143533   .3311488   -18.55   0.000    -6.792573   -5.494493
                                                                      130  |  -6.062978   .3265377   -18.57   0.000     -6.70298   -5.422975
                                                                      135  |  -5.761519   .4773724   -12.07   0.000    -6.697152   -4.825886
                                                                      140  |  -5.778329   .4380081   -13.19   0.000    -6.636809   -4.919849
                                                                      145  |   .2658615     .93645     0.28   0.776    -1.569547     2.10127
                                                                      150  |  -5.810276    .609025    -9.54   0.000    -7.003943   -4.616609
                                                                      155  |  -5.768501   .3534187   -16.32   0.000    -6.461189   -5.075813
                                                                      160  |    .149793   .6615681     0.23   0.821    -1.146857    1.446443
                                                                      165  |  -5.953591   .3434378   -17.34   0.000    -6.626717   -5.280466
                                                                      200  |  -.0136433   .4344877    -0.03   0.975    -.8652237     .837937
                                                                      205  |  -5.890713   .4602006   -12.80   0.000     -6.79269   -4.988736
                                                                      210  |   .9719786   .5635791     1.72   0.085    -.1326162    2.076573
                                                                      211  |   .9343074   .7089067     1.32   0.188    -.4551242    2.323739
                                                                      220  |   .1942997   .4272238     0.45   0.649    -.6430436    1.031643
                                                                      225  |   .8457318   .9215679     0.92   0.359    -.9605081    2.651972
                                                                      230  |  -.5203722   .6361281    -0.82   0.413     -1.76716     .726416
                                                                      235  |   .1509683   .6859142     0.22   0.826    -1.193399    1.495335
                                                                      255  |  -5.286256   .3309054   -15.98   0.000    -5.934819   -4.637694
                                                                      260  |   .5475508    .528531     1.04   0.300     -.488351    1.583452
                                                                      265  |  -6.246644    .308984   -20.22   0.000    -6.852241   -5.641046
                                                                      290  |   .7981032   .6092893     1.31   0.190    -.3960819    1.992288
                                                                      305  |   .7026781   .6504374     1.08   0.280    -.5721558    1.977512
                                                                      310  |   .8484704   .9207747     0.92   0.357    -.9562148    2.653156
                                                                      315  |   6.989914    .335309    20.85   0.000      6.33272    7.647107
                                                                      317  |  -6.013102   .4619937   -13.02   0.000    -6.918593   -5.107611
                                                                      325  |    .117411   .4526924     0.26   0.795    -.7698498    1.004672
                                                                      338  |  -6.013102   .4619937   -13.02   0.000    -6.918593   -5.107611
                                                                      339  |   .1056245   .9166871     0.12   0.908    -1.691049    1.902298
                                                                      343  |   .0468828   .6594538     0.07   0.943    -1.245623    1.339388
                                                                      344  |  -5.819621   .6032538    -9.65   0.000    -7.001977   -4.637266
                                                                      345  |  -.1658893   .5783998    -0.29   0.774    -1.299532    .9677534
      
                                                                           |
                                                                     _cons |  -.7729151   .3722375    -2.08   0.038    -1.502487    -.043343
      ---------------------------------------------------------------------+----------------------------------------------------------------
      StageTwo                                                           |
                                                  X |   .1531247   .1647189     0.93   0.353    -.1697185    .4759679
                                                               Y |  -.2938013   .1135934    -2.59   0.010    -.5164403   -.0711624
                                                      DurationToStageTwo |  -1.075724   .1516215    -7.09   0.000    -1.372897    -.778551
                                                                           |
                             c.DurationToStageTwo#c.DurationToStageTwo |   .2234559   .0628989     3.55   0.000     .1001762    .3467356
                                                                           |
      c.DurationToStageTwo#c.DurationToStageTwo#c.DurationToStageTwo |  -.0136971   .0061262    -2.24   0.025    -.0257043   -.0016899
                                                                           |
                                                               attackedstate |
                                                                       20  |   .1297424    .269483     0.48   0.630    -.3984346    .6579195
                                                                       31  |  -4.658599   .3221707   -14.46   0.000    -5.290042   -4.027156
                                                                       40  |   .4427582   .7458496     0.59   0.553     -1.01908    1.904597
                                                                       41  |   .3623409   .5574355     0.65   0.516    -.7302126    1.454895
                                                                       42  |   .6010684   .4888079     1.23   0.219    -.3569774    1.559114
                                                                       52  |   7.035505   .3257632    21.60   0.000     6.397021    7.673989
                                                                       53  |   .8263333   .7766891     1.06   0.287    -.6959494    2.348616
                                                                       54  |   .5757154   .8629559     0.67   0.505    -1.115647    2.267078
                                                                       55  |  -4.658599   .3221707   -14.46   0.000    -5.290042   -4.027156
                                                                       56  |  -4.658599   .3221707   -14.46   0.000    -5.290042   -4.027156
                                                                       57  |   .8263333   .7766891     1.06   0.287    -.6959494    2.348616
                                                                       58  |   1.076951   .8677649     1.24   0.215    -.6238369    2.777739
                                                                       60  |  -5.159835   .3100785   -16.64   0.000    -5.767577   -4.552092
                                                                       70  |   .3566825   .3568046     1.00   0.317    -.3426416    1.056007
                                                                       80  |  -4.737321   .2451133   -19.33   0.000    -5.217734   -4.256908
                                                                       90  |   .2518184   .4230897     0.60   0.552    -.5774221    1.081059
                                                                       91  |  -.4082256   .5658449    -0.72   0.471    -1.517261    .7008101
                                                                       92  |   .1034041   .6124384     0.17   0.866    -1.096953    1.303761
                                                                       93  |    .657758   .6462358     1.02   0.309    -.6088408    1.924357
                                                                       94  |   1.044464    .619916     1.68   0.092    -.1705491    2.259477
                                                                       95  |   .3611426   .4623504     0.78   0.435    -.5450476    1.267333
                                                                      100  |   .3102461   .5197335     0.60   0.551    -.7084128    1.328905
                                                                      101  |   .8145613   .7290841     1.12   0.264    -.6144173     2.24354
                                                                      130  |   .8543246   .5573469     1.53   0.125    -.2380553    1.946704
                                                                      135  |  -.2845244   .5266045    -0.54   0.589     -1.31665    .7476014
                                                                      140  |   -.165701    .494342    -0.34   0.737    -1.134593    .8031915
                                                                      145  |   .3257782   .8087907     0.40   0.687    -1.259423    1.910979
                                                                      150  |   .1276156   1.045843     0.12   0.903      -1.9222    2.177431
                                                                      155  |    .552495   .4534581     1.22   0.223    -.3362665    1.441256
                                                                      160  |   .0622354   .4370698     0.14   0.887    -.7944057    .9188766
                                                                      165  |   .8241247    .693988     1.19   0.235    -.5360668    2.184316
                                                                      200  |   .2395174    .302417     0.79   0.428     -.353209    .8322438
                                                                      205  |   6.666758   .3073128    21.69   0.000     6.064436     7.26908
                                                                      210  |   .4006377   .4450945     0.90   0.368    -.4717315    1.273007
                                                                      211  |  -.2639231   .5348542    -0.49   0.622    -1.312218    .7843718
                                                                      220  |    .391216   .3016976     1.30   0.195    -.2001005    .9825325
                                                                      221  |  -4.459033   .7826024    -5.70   0.000    -5.992906   -2.925161
                                                                      223  |  -4.868655   .4748079   -10.25   0.000    -5.799261   -3.938048
                                                                      225  |   .1762539   .4633132     0.38   0.704    -.7318233    1.084331
                                                                      230  |   .0084466    .417298     0.02   0.984    -.8094424    .8263356
                                                                      232  |  -4.868655   .4748079   -10.25   0.000    -5.799261   -3.938048
                                                                      235  |   .5734324   .4929543     1.16   0.245    -.3927403    1.539605
                                                                      255  |   .0461835   .6583125     0.07   0.944    -1.244085    1.336452
                                                                      260  |  -.0148834   .3849892    -0.04   0.969    -.7694484    .7396817
                                                                      265  |   .7407363   .4786308     1.55   0.122    -.1973629    1.678836
                                                                      290  |    .523521   .5139486     1.02   0.308    -.4837998    1.530842
                                                                      305  |    .006578   .5705469     0.01   0.991    -1.111673    1.124829
                                                                      310  |   .1388734    .458817     0.30   0.762    -.7603915    1.038138
                                                                      315  |   .1998819     .56852     0.35   0.725    -.9143967    1.314161
                                                                      316  |  -5.227642   .2189271   -23.88   0.000    -5.656731   -4.798553
                                                                      317  |    6.31558   .2898063    21.79   0.000      5.74757     6.88359
                                                                      325  |  -.1625863   .3203744    -0.51   0.612    -.7905085    .4653359
                                                                      331  |  -4.752834   .7722411    -6.15   0.000    -6.266399    -3.23927
                                                                      338  |   6.816816   .3049406    22.35   0.000     6.219143    7.414488
                                                                      339  |   .2978363   .6008857     0.50   0.620    -.8798779    1.475551
                                                                      343  |  -.0824077   .6365544    -0.13   0.897    -1.330031    1.165216
                                                                      344  |    .432357   1.221126     0.35   0.723    -1.961005    2.825719
                                                                      345  |   .8916468   .5248766     1.70   0.089    -.1370925    1.920386
      
                                                                           |
                                                                     _cons |   .2840256   .1585941     1.79   0.073    -.0268131    .5948644
      ---------------------------------------------------------------------+----------------------------------------------------------------
                                                                   /athrho |  -.1385913   .3754925    -0.37   0.712     -.874543    .5973604
      ---------------------------------------------------------------------+----------------------------------------------------------------
                                                                       rho |  -.1377107   .3683715                     -.7036749    .5351686
      --------------------------------------------------------------------------------------------------------------------------------------
      Wald test of indep. eqns. (rho = 0): chi2(1) = 0.14       Prob > chi2 = 0.7121
      And this is without the FEs:

      Code:
      . heckprobit Success X Y, select(StageTwo= X Y c.DurationToStageTwo##c.DurationToStageTwo##c
      > .DurationToStageTwo) vce(robust)
      
      Fitting probit model:
      
      Iteration 0:   log pseudolikelihood = -338.09506  
      Iteration 1:   log pseudolikelihood = -316.00875  
      Iteration 2:   log pseudolikelihood = -315.97979  
      Iteration 3:   log pseudolikelihood = -315.97979  
      
      Fitting selection model:
      
      Iteration 0:   log pseudolikelihood = -714.76771  
      Iteration 1:   log pseudolikelihood = -648.38511  
      Iteration 2:   log pseudolikelihood = -647.51528  
      Iteration 3:   log pseudolikelihood = -646.66251  
      Iteration 4:   log pseudolikelihood = -645.92775  
      Iteration 5:   log pseudolikelihood =  -645.9028  
      Iteration 6:   log pseudolikelihood = -645.90279  
      
      Fitting starting values:
      
      Iteration 0:   log pseudolikelihood = -369.44745  
      Iteration 1:   log pseudolikelihood = -315.82693  
      Iteration 2:   log pseudolikelihood = -315.75587  
      Iteration 3:   log pseudolikelihood = -315.75587  
      
      Fitting full model:
      
      Iteration 0:   log pseudolikelihood = -961.65992  
      Iteration 1:   log pseudolikelihood = -961.63515  
      Iteration 2:   log pseudolikelihood = -961.63515  
      
      Probit model with sample selection              Number of obs     =      1,032
                                                            Selected    =        533
                                                            Nonselected =        499
      
                                                      Wald chi2(2)      =      45.17
      Log pseudolikelihood = -961.6351                Prob > chi2       =     0.0000
      
      --------------------------------------------------------------------------------------------------------------------------------------
                                                                           |               Robust
                                                                           | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      ---------------------------------------------------------------------+----------------------------------------------------------------
      Success                                                              |
                                                 X |   .4541016   .1390817     3.26   0.001     .1815064    .7266967
                                                               Y |   .8743862   .1348664     6.48   0.000      .610053    1.138719
                                                                     _cons |  -.6391686   .1917759    -3.33   0.001    -1.015042   -.2632948
      ---------------------------------------------------------------------+----------------------------------------------------------------
      StageTwo                                                           |
                                                  X |   .1893418    .124708     1.52   0.129    -.0550814     .433765
                                                               Y |  -.1261008   .0909988    -1.39   0.166    -.3044551    .0522536
                                                      DurationToStageTwo |  -.8258687   .1338654    -6.17   0.000     -1.08824   -.5634973
                                                                           |
                             c.DurationToStageTwo#c.DurationToStageTwo |    .154316   .0590995     2.61   0.009      .038483     .270149
                                                                           |
      c.DurationToStageTwo#c.DurationToStageTwo#c.DurationToStageTwo |  -.0093486   .0059401    -1.57   0.116     -.020991    .0022938
                                                                           |
                                                                     _cons |   .3516954   .0550795     6.39   0.000     .2437416    .4596492
      ---------------------------------------------------------------------+----------------------------------------------------------------
                                                                   /athrho |  -.1859254    .253408    -0.73   0.463     -.682596    .3107452
      ---------------------------------------------------------------------+----------------------------------------------------------------
                                                                       rho |  -.1838123   .2448461                     -.5932045    .3011149
      --------------------------------------------------------------------------------------------------------------------------------------
      Wald test of indep. eqns. (rho = 0): chi2(1) = 0.54       Prob > chi2 = 0.4631
      Thank you very much!

      Comment


      • #4
        Hans:
        if you have already double-checked that there's no other explanation (say, the number of sample observations minus the number of omitted observations in your first code equals, for any reason, the number of observations in your secon code), I do not have an explanation for that.
        About the missing Wald chi2 statistic, it depends on the huge number of predictors + cluster robust standard errors (see help -j_robustsingular-).
        Last edited by Carlo Lazzaro; 21 Jan 2023, 05:35.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X