Announcement

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

  • Two-part model (twopm). All variables omitted in part two

    Dear all,

    I am relatively new to both STATA and two-part models. I am running a two-part model with the twopm command to estimate whether violent protest succeeds, determined on whether violent protest is observed. First stage is a probit regression, while the second part is OLS regression. However, all variables are omitted in part two of the model. Since no error code shows up I am having trouble understanding what I am doing wrong and whether the problem lies in my data itself or my limited stata syntax skills.

    My regression output looks like this:
    Code:
    twopm (violent_success = election_dummy lagfpe lnregime_change lagpolity2 lagpolitysquare lnlaggdp lnlagpop asia eur
    > ope oceania americas decade_1940 decade_1950 decade_1960 decade_1970 decade_1980 decade_1990 decade_2010) (violent_s
    > uccess = lagfpe lnregime_change lagpolity2 lagpolitysquare lnlaggdp lnlagpop asia europe oceania americas decade_194
    > 0 decade_1950 decade_1960 decade_1970 decade_1980 decade_1990 decade_2010), firstpart(probit) secondpart(regress)
    
    Fitting probit regression for first part:
    
    Iteration 0:   log likelihood = -5637.7117  
    Iteration 1:   log likelihood = -4288.3063  
    Iteration 2:   log likelihood = -4230.5122  
    Iteration 3:   log likelihood = -4230.0294  
    Iteration 4:   log likelihood = -4230.0283  
    Iteration 5:   log likelihood = -4230.0283  
    
    Fitting OLS regression for second part:
    
    Two-part model
    ------------------------------------------------------------------------------
    Log pseudolikelihood =          .                 Number of obs   =      11973
    
    Part 1: probit
    ------------------------------------------------------------------------------
                                                      Number of obs   =      11973
                                                      LR chi2(18)     =    2815.37
                                                      Prob > chi2     =     0.0000
    Log likelihood = -4230.0283                       Pseudo R2       =     0.2497
    
    Part 2: regress
    ------------------------------------------------------------------------------
                                                      Number of obs   =         56
                                                      F(  17,     38) =          .
                                                      Prob > F        =          .
                                                      Root MSE        =     0.0000
    ---------------------------------------------------------------------------------
    violent_success | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    ----------------+----------------------------------------------------------------
    probit          |
     election_dummy |   .1426957   .0392658     3.63   0.000     .0657362    .2196552
             lagfpe |   1.752965   .1111909    15.77   0.000     1.535035    1.970896
    lnregime_change |   .0615375    .015632     3.94   0.000     .0308994    .0921756
         lagpolity2 |  -.0379218   .0031117   -12.19   0.000    -.0440206    -.031823
    lagpolitysquare |   .0053864   .0005905     9.12   0.000      .004229    .0065438
           lnlaggdp |   .0785088   .0136674     5.74   0.000     .0517212    .1052964
           lnlagpop |  -.3440837   .0149842   -22.96   0.000    -.3734522   -.3147152
               asia |  -.4082373   .0384613   -10.61   0.000    -.4836201   -.3328544
             europe |   .1167027   .0623777     1.87   0.061    -.0055555    .2389608
            oceania |   .7493155   .1628974     4.60   0.000     .4300425    1.068588
           americas |   .2886768   .0553189     5.22   0.000     .1802537    .3970998
        decade_1940 |   .8427197   .0791006    10.65   0.000     .6876855     .997754
        decade_1950 |   .8100949   .0642703    12.60   0.000     .6841275    .9360623
        decade_1960 |   .2894294   .0594339     4.87   0.000      .172941    .4059178
        decade_1970 |   .0942037   .0565811     1.66   0.096    -.0166932    .2051005
        decade_1980 |  -.2496582    .051532    -4.84   0.000    -.3506591   -.1486574
        decade_1990 |  -.3083924   .0482601    -6.39   0.000    -.4029805   -.2138042
        decade_2010 |  -.0781374   .0775808    -1.01   0.314    -.2301929    .0739181
              _cons |    3.37427   .1879564    17.95   0.000     3.005882    3.742658
    ----------------+----------------------------------------------------------------
    regress         |
             lagfpe |          0  (omitted)
    lnregime_change |          0  (omitted)
         lagpolity2 |          0  (omitted)
    lagpolitysquare |          0  (omitted)
           lnlaggdp |          0  (omitted)
           lnlagpop |          0  (omitted)
               asia |          0  (omitted)
             europe |          0  (omitted)
            oceania |          0  (omitted)
           americas |          0  (omitted)
        decade_1940 |          0  (omitted)
        decade_1950 |          0  (omitted)
        decade_1960 |          0  (omitted)
        decade_1970 |          0  (omitted)
        decade_1980 |          0  (omitted)
        decade_1990 |          0  (omitted)
        decade_2010 |          0  (omitted)
              _cons |          1          .        .       .            .           .
    ---------------------------------------------------------------------------------
    Simple dataexample:
    Code:
    clear
    input byte(violent_onset violent_success election_dummy) float(lagfpe lnregime_change lagpolity2 lagpolitysquare lnlaggdp lnlagpop) byte(asia europe oceania americas decade_1940 decade_1950 decade_1960 decade_1970 decade_1980 decade_1990 decade_2010)
    0 . 0 .469 4.3820267  9  81  26.20377  23.64081 0 0 0 1 1 0 0 0 0 0 0
    0 . 1 .487  4.394449  9  81  24.59919  23.18342 0 0 0 1 1 0 0 0 0 0 0
    0 . 0 .494  4.406719  9  81 28.993723 20.340067 0 0 0 1 1 0 0 0 0 0 0
    0 . 1 .503 4.4188404  9  81  28.44062 18.560905 0 0 0 1 1 0 0 0 0 0 0
    0 . 0 .496 4.4308167  9  81  28.07744 18.079203 0 0 0 1 1 0 0 0 0 0 0
    0 . 1 .496 4.4426513  9  81 29.790625  19.92198 0 0 0 1 0 0 0 0 0 0 0
    0 . 0 .504  4.454347  9  81 28.209656 17.630175 0 0 0 1 0 1 0 0 0 0 0
    0 . 1 .504  4.465908  9  81 27.091743  19.77127 0 0 0 1 0 1 0 0 0 0 0
    0 . 0 .506  4.477337  9  81  27.49465  19.64414 0 0 0 1 0 1 0 0 0 0 0
    0 . 1  .51 4.4886365  9  81  25.21628 20.393696 0 0 0 1 0 1 0 0 0 0 0
    0 . 0 .513 4.4998097  9  81  28.90716  20.77597 0 0 0 1 0 1 0 0 0 0 0
    0 . 1 .516 4.5108595  9  81  29.09658  20.42168 0 0 0 1 0 1 0 0 0 0 0
    0 . 0 .525 4.5217886  9  81 28.593616 19.474043 0 0 0 1 0 1 0 0 0 0 0
    0 . 1 .531 4.5325994  9  81  28.26459 19.097534 0 0 0 1 0 1 0 0 0 0 0
    0 . 0 .527  4.543295  9  81  24.46456 17.672415 0 0 0 1 0 1 0 0 0 0 0
    0 . 1 .527  4.553877  9  81 29.429653  20.50381 0 0 0 1 0 0 0 0 0 0 0
    0 . 0 .566  4.564348  9  81  27.02093 19.012188 0 0 0 1 0 0 1 0 0 0 0
    0 . 1 .566  4.574711  9  81  27.05708 19.028765 0 0 0 1 0 0 1 0 0 0 0
    0 . 0 .566 4.5849676  9  81  27.12866 19.044146 0 0 0 1 0 0 1 0 0 0 0
    0 . 1 .566   4.59512  9  81 27.182545 19.058537 0 0 0 1 0 0 1 0 0 0 0
    0 . 0 .576 4.6051702  9  81  27.25385 19.072428 0 0 0 1 0 0 1 0 0 0 0
    0 . 1 .576 4.6151204  9  81 27.334904  19.08493 0 0 0 1 0 0 1 0 0 0 0
    0 . 0 .588  4.624973  9  81 27.426455  19.09648 0 0 0 1 0 0 1 0 0 0 0
    0 . 1 .588  4.634729  8  64 27.482174 19.107367 0 0 0 1 0 0 1 0 0 0 0
    0 . 0 .597  4.644391  8  64   27.5718  19.11735 0 0 0 1 0 0 1 0 0 0 0
    0 . 1 .623   4.65396  8  64 27.650726 19.127125 0 0 0 1 0 0 0 0 0 0 0
    0 . 0 .674 4.6634393  8  64  27.70176 19.138775 0 0 0 1 0 0 0 1 0 0 0
    0 . 1 .684 4.6728287  8  64 27.783613 19.151417 0 0 0 1 0 0 0 1 0 0 0
    0 . 0 .693 4.6821313  8  64 27.877186  19.16212 0 0 0 1 0 0 0 1 0 0 0
    0 . 1 .692  4.691348  8  64 27.985456 19.171667 0 0 0 1 0 0 0 1 0 0 0
    0 . 0 .713 4.7004805 10 100   28.0662 19.180803 0 0 0 1 0 0 0 1 0 0 0
    0 . 1 .734 4.7095304 10 100  28.15273 19.190664 0 0 0 1 0 0 0 1 0 0 0
    0 . 0  .75 4.7184987 10 100 28.258783 19.200167 0 0 0 1 0 0 0 1 0 0 0
    0 . 1  .75  4.727388 10 100  28.36427 19.210224 0 0 0 1 0 0 0 1 0 0 0
    0 . 0 .748 4.7361984 10 100 28.486116  19.22082 0 0 0 1 0 0 0 1 0 0 0
    Any tips on what I am doing wrong would be greatly appreciated!
    Last edited by Birte Olsen; 04 Mar 2022, 06:44.

  • #2
    I believe your understanding of twopm is incomplete. Your outcome is violent_success, which is stored as a byte variable. This suggests it takes only discrete values, and not very many such values. The name alone suggests two possibilities: violent protest succeeds, or violent protest fails. But a look at the output of the help twopm command shows us

    twopm fits a two-part regression model of depvar on indepvars. The first part models the probability that depvar>0 using a binary choice model (logit or probit). The second part models the distribution of depvar | depvar>0 using linear (regress) and generalized linear models (glm).
    and

    twopm is designed to estimate models in which the positive outcome is continuous. It does not deal with discrete or count outcomes.
    So this suggests that twopm is not a suitable tool for your problem. In particular, if violent_success takes only two values, then for those observations where it is greater than zero, it must be 1, and the second part has nothing to explain, yielding a constant of 1, which is identical to the value, and omitting all other variables since they add nothing to the model. Which looks a lot like the output from your second part model.

    Last edited by William Lisowski; 04 Mar 2022, 12:57.

    Comment


    • #3
      William's comment in #2 is spot on. I might add that your data example indicates that your dependent variable, violent_success, is missing for all the observations listed. The probit output suggests that it may be nonmissing for only 56 observations and, since the probit model appears to have converged, must have at least two distinct values among those that are non-missing. So my recommendation would be to first explore whether violent_success is in fact coded appropriately.

      Comment


      • #4
        Dear William and John,

        Thank you very much! I should have had a closer read of the twopm code...

        I ended up manually doing a two-stage logit model following the 2PM approach instead.

        Comment

        Working...
        X