Announcement

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

  • FE-IV with quadratic endogenous variable

    Hi all,

    I am currently looking at the effects of hours worked on physical health using panel data. There is reason to believe that this relationship is non-linear, i.e., working an x-amount of hours may improve your physical health, but at some point, it will take a toll on your physical health (inverted U-shaped relationship).

    Imagine I ran the following code in STATA:

    Code:
     xi: xtivreg2 PH q (HW HW^2 = z), fe
    where:

    > PH is a continuous variable measuring physical health, with a range of 0 (low functioning) to 100 (high functioning)
    > q is a set of exogenous variables.
    > HW / HW^2 are the variables denoting the No. of hours normally worked per week, which I suspect are endogenous.
    > z is, what I think, a non-weak instrument, which is a dummy variable.

    The issue here is that I am unable to find a second instrument for my regression. And since z is a dummy, I am unable to square it as you would do with a continuous variable.

    My question is, is there an econometric technique to tackle the fact that two variables (hours worked, and hours worked squared) are endogenous with only one dummy instrument, or is it simply not possible?

    Thanks for all the help in advance!

    Luc
    Last edited by Luc Nguyen; 18 Aug 2023, 04:18.

  • #2
    I've seen this sort of thing done.

    HTML Code:
    https://www.statalist.org/forums/forum/general-stata-discussion/general/1701746-2sls-with-endogenous-variable-z-fitted-values-from-1st-stage-instrument
    You estimate equations for HW and HW^2 and use the predictions as instruments in the xtivreg2 command.

    G

    Comment


    • #3
      George's solution might work, but it requires an extra x in the equation -- your q variable in your case -- that definitely appears in the first stage for HW. Even if it does, the resulting IV might be weak.

      Another possibility is to use a control function approach.

      Code:
      xtreg HW q z, fe
      predict vhat, e
      xtreg PH HW c.HW#c.HW vhat q, fe vce(cluster id)
      The standard errors in the second estimation are generally incorrect because they don't adjust for estimation of vhat. But it's easy to bootstrap both steps.

      Comment


      • #4
        Thank you both for your suggestions. I tried both, and the control function approach yielded "better" results with my instrument. Just to double-check, below are the results, I hope I did it right... How do I adjust the standard errors in Stata for the second stage?

        As for the variables used;
        > sf12pcs_dv represents the continuous variable measuring physical health
        > jbhrs is the No. of hours normally worked per week
        > nchunder16 is my instrument ("z")

        Code:
        xtreg jbhrs dvage married hhsize mh_dv1 i.qfhigh_dv i.jbrgsc_dv i.jbpl j2has urban_dv i.gor_dv i.year nchunder16 if sex_dv == 1 & employ == 1, fe
        
        Fixed-effects (within) regression               Number of obs     =     60,089
        Group variable: pidp                            Number of groups  =     13,034
        
        R-squared:                                      Obs per group:
             Within  = 0.0304                                         min =          1
             Between = 0.0099                                         avg =        4.6
             Overall = 0.0015                                         max =         12
        
                                                        F(42,47013)       =      35.07
        corr(u_i, Xb) = -0.5363                         Prob > F          =     0.0000
        
        -------------------------------------------------------------------------------------
                      jbhrs | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        --------------------+----------------------------------------------------------------
                      dvage |   .1594898   .1052088     1.52   0.130     -.046721    .3657006
                    married |   .4855547   .1375986     3.53   0.000     .2158595    .7552499
                     hhsize |  -.3339338   .0502108    -6.65   0.000    -.4323476     -.23552
                     mh_dv1 |   .0259449   .0907773     0.29   0.775      -.15198    .2038697
                            |
                  qfhigh_dv |
        1st degree or eq..  |  -1.000311   .4381971    -2.28   0.022    -1.859183    -.141438
                   A level  |  -7.328987   .5122484   -14.31   0.000    -8.333001   -6.324972
              GCSE/O level  |  -9.917486   .5463722   -18.15   0.000    -10.98838   -8.846588
         None of the above  |  -8.308353   .4704644   -17.66   0.000     -9.23047   -7.386236
                            |
                  jbrgsc_dv |
        managerial & tec..  |   .1061291   .2332947     0.45   0.649    -.3511318      .56339
        skilled non-manual  |  -2.146714   .2609277    -8.23   0.000    -2.658137   -1.635292
            skilled manual  |  -1.120323   .2698386    -4.15   0.000     -1.64921    -.591435
        partly skilled o..  |   -3.13389   .2799163   -11.20   0.000     -3.68253    -2.58525
        unskilled occupa..  |  -2.567031    .336432    -7.63   0.000    -3.226442   -1.907619
                            |
                       jbpl |
        At your employer..  |   .3104018   .1711999     1.81   0.070    -.0251525    .6459561
        Driving or trave..  |   .5808678   .1999707     2.90   0.004     .1889224    .9728133
        Or at one or mor..  |   .6329742     .19781     3.20   0.001     .2452637    1.020685
         SPONTANEOUS Other  |    1.07363    .394049     2.72   0.006     .3012884    1.845972
                            |
                      j2has |   1.795575   .1419171    12.65   0.000     1.517415    2.073734
                   urban_dv |  -.4086814   .1947922    -2.10   0.036    -.7904769   -.0268859
                            |
                     gor_dv |
                North West  |  -1.878361   1.090768    -1.72   0.085    -4.016282    .2595602
        Yorkshire and th..  |  -1.986552   1.034807    -1.92   0.055    -4.014788    .0416842
             East Midlands  |  -2.838112   1.156183    -2.45   0.014    -5.104248   -.5719754
             West Midlands  |  -2.251281   1.134119    -1.99   0.047    -4.474171   -.0283919
           East of England  |  -1.133398   1.138457    -1.00   0.319    -3.364789    1.097994
                    London  |  -1.088907   1.109957    -0.98   0.327     -3.26444    1.086626
                South East  |  -1.144854   1.106345    -1.03   0.301    -3.313307    1.023598
                South West  |  -1.580609   1.158272    -1.36   0.172     -3.85084    .6896219
                     Wales  |  -4.338598    1.35419    -3.20   0.001     -6.99283   -1.684366
                  Scotland  |  -5.279508   1.194328    -4.42   0.000    -7.620408   -2.938609
          Northern Ireland  |   -2.47921    1.77812    -1.39   0.163    -5.964351    1.005931
                            |
                       year |
                      2010  |   -.408918    .152431    -2.68   0.007     -.707685   -.1101511
                      2011  |  -.6925551    .240089    -2.88   0.004    -1.163133   -.2219772
                      2012  |  -.9540243   .3387319    -2.82   0.005    -1.617944   -.2901049
                      2013  |  -1.161776   .4398307    -2.64   0.008    -2.023851   -.2997015
                      2014  |  -1.419908   .5440084    -2.61   0.009    -2.486173   -.3536441
                      2015  |  -1.617174   .6476885    -2.50   0.013    -2.886653    -.347695
                      2016  |  -1.872816   .7492509    -2.50   0.012    -3.341359   -.4042737
                      2017  |  -2.155606   .8536827    -2.53   0.012    -3.828836   -.4823754
                      2018  |  -2.149697   .9562561    -2.25   0.025    -4.023973   -.2754209
                      2019  |  -2.641438   1.059903    -2.49   0.013    -4.718863   -.5640127
                      2020  |  -2.820414   1.162619    -2.43   0.015    -5.099165   -.5416634
                            |
                 nchunder16 |   .2149353   .0660266     3.26   0.001     .0855222    .3443484
                      _cons |   38.24314   4.133731     9.25   0.000     30.14097    46.34532
        --------------------+----------------------------------------------------------------
                    sigma_u |  10.508088
                    sigma_e |  5.7963907
                        rho |   .7667088   (fraction of variance due to u_i)
        -------------------------------------------------------------------------------------
        F test that all u_i=0: F(13033, 47013) = 7.58                Prob > F = 0.0000
        
        
        predict vhat, e
        (275,002 missing values generated)
        
        
        xtreg sf12pcs_dv jbhrs c.jbhrs#c.jbhrs vhat dvage married hhsize mh_dv1 i.qfhigh_dv i.jbrgsc_dv i.jbpl j2has urban_dv i.gor_dv i.year, fe vce(cluster pidp)
        
        Fixed-effects (within) regression               Number of obs     =     59,583
        Group variable: pidp                            Number of groups  =     12,990
        
        R-squared:                                      Obs per group:
             Within  = 0.0115                                         min =          1
             Between = 0.0059                                         avg =        4.6
             Overall = 0.0034                                         max =         12
        
                                                        F(44,12989)       =       8.05
        corr(u_i, Xb) = -0.7119                         Prob > F          =     0.0000
        
                                             (Std. err. adjusted for 12,990 clusters in pidp)
        -------------------------------------------------------------------------------------
                            |               Robust
                 sf12pcs_dv | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        --------------------+----------------------------------------------------------------
                      jbhrs |   .6934251   .3199868     2.17   0.030     .0662041    1.320646
                            |
            c.jbhrs#c.jbhrs |  -.0004355   .0001683    -2.59   0.010    -.0007654   -.0001055
                            |
                       vhat |  -.6492582   .3200159    -2.03   0.042    -1.276536     -.02198
                      dvage |  -.1652542   .1103911    -1.50   0.134     -.381637    .0511286
                    married |  -.4674809   .2233065    -2.09   0.036    -.9051944   -.0297674
                     hhsize |    .219635   .0944863     2.32   0.020     .0344281    .4048419
                     mh_dv1 |   .7362578   .1146355     6.42   0.000     .5115554    .9609601
                            |
                  qfhigh_dv |
        1st degree or eq..  |   .8378768   .5037108     1.66   0.096    -.1494703    1.825224
                   A level  |   3.994628   2.399016     1.67   0.096    -.7077952    8.697051
              GCSE/O level  |   6.073666   3.234546     1.88   0.060    -.2665187    12.41385
         None of the above  |   4.717639    2.70648     1.74   0.081    -.5874584    10.02274
                            |
                  jbrgsc_dv |
        managerial & tec..  |  -.2221832    .210739    -1.05   0.292    -.6352626    .1908961
        skilled non-manual  |   1.422117   .7382663     1.93   0.054    -.0249934    2.869227
            skilled manual  |   .6542066   .4496283     1.45   0.146    -.2271307    1.535544
        partly skilled o..  |    1.92226   1.054441     1.82   0.068    -.1445993     3.98912
        unskilled occupa..  |    1.56837    .913718     1.72   0.086    -.2226514    3.359391
                            |
                       jbpl |
        At your employer..  |  -.3902609   .1893624    -2.06   0.039    -.7614391   -.0190828
        Driving or trave..  |  -.2434599   .2702937    -0.90   0.368    -.7732753    .2863554
        Or at one or mor..  |  -.4334897   .2786316    -1.56   0.120    -.9796485     .112669
         SPONTANEOUS Other  |  -.4848773   .5070672    -0.96   0.339    -1.478803    .5090488
                            |
                      j2has |  -1.259948   .5924512    -2.13   0.033    -2.421239   -.0986567
                   urban_dv |   .6597886   .2272884     2.90   0.004     .2142701    1.105307
                            |
                     gor_dv |
                North West  |   2.123956   1.374238     1.55   0.122    -.5697514    4.817664
        Yorkshire and th..  |   2.743164   1.258908     2.18   0.029     .2755188    5.210809
             East Midlands  |   3.239816   1.593356     2.03   0.042     .1166043    6.363028
             West Midlands  |   3.111558   1.668454     1.86   0.062    -.1588568    6.381973
           East of England  |    2.88427   1.401706     2.06   0.040     .1367195     5.63182
                    London  |   2.903864    1.33502     2.18   0.030     .2870289    5.520699
                South East  |   2.565106   1.349864     1.90   0.057    -.0808264    5.211038
                South West  |   3.102943   1.455778     2.13   0.033     .2494043    5.956482
                     Wales  |    6.14632    2.15404     2.85   0.004     1.924085    10.36855
                  Scotland  |    4.10806   2.074958     1.98   0.048     .0408368    8.175283
          Northern Ireland  |   3.956089    1.67747     2.36   0.018     .6680024    7.244176
                            |
                       year |
                      2010  |   .4030869   .1948526     2.07   0.039     .0211472    .7850266
                      2011  |   .4939884   .3228141     1.53   0.126    -.1387747    1.126751
                      2012  |   .6036291   .4449722     1.36   0.175    -.2685817     1.47584
                      2013  |   .5190652   .5613394     0.92   0.355    -.5812424    1.619373
                      2014  |   .8332941   .6908966     1.21   0.228    -.5209645    2.187553
                      2015  |   .6435381   .8056211     0.80   0.424    -.9355975    2.222674
                      2016  |    .886837   .9271781     0.96   0.339     -.930568    2.704242
                      2017  |   .7902299   1.063425     0.74   0.457    -1.294238    2.874698
                      2018  |   .4420441   1.136793     0.39   0.697    -1.786237    2.670325
                      2019  |   .9367959   1.312854     0.71   0.476     -1.63659    3.510182
                      2020  |    1.01104   1.425143     0.71   0.478    -1.782449    3.804529
                            |
                      _cons |   28.75708   12.64283     2.27   0.023     3.975269    53.53888
        --------------------+----------------------------------------------------------------
                    sigma_u |   9.283354
                    sigma_e |  5.2296585
                        rho |  .75910041   (fraction of variance due to u_i)
        -------------------------------------------------------------------------------------
        
        .
        end of do-file
        Last edited by Luc Nguyen; 19 Aug 2023, 11:14.

        Comment


        • #5
          Use the panel bootstrap applied to both steps of the estimation. That should run fairly quickly. If you want a reference for the unbalanced case, it’s in a paper of mine with a former student, Riju Joshi. Annals of Economics and Statistics.

          Comment

          Working...
          X