Announcement

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

  • Testing the Coefficients of OLS and 2SLS Regression

    Hi all,

    I am replicating one of Krueger's papers.

    For two regressions, how can I test whether the coefficients of small1 are the same? I try commands like test, estout and test, but they do not work.

    OLS: regress averscore1 small1 reaide1 if star1 == 1, cluster(schid1)
    2SLS: ivregress 2sls averscore1 reaide1 (small1 = ismall) if star1 == 1, cluster(schid1)

    Thank you for your help!!!

    Best,
    Yiling

  • #2
    You can try the gmm command and test.

    Code:
    webuse hsng2, clear
    ivregress 2sls rent pcturban (hsngval = faminc), robust
    regress rent pcturban hsngval, robust
    
    gmm (eq1: rent - {b1}*hsngval - {b2}*pcturban - {b0}) ///
        (eq2: rent - {xb: pcturban hsngval} - {c0}), ///
        instruments(eq1: pcturban faminc) ///
        instruments(eq2: pcturban hsngval) ///
        onestep winitial(unadjusted, indep)
    Res.:

    Code:
    . ivregress 2sls rent pcturban (hsngval = faminc), robust
    
    Instrumental variables 2SLS regression            Number of obs   =         50
                                                      Wald chi2(2)    =      32.55
                                                      Prob > chi2     =     0.0000
                                                      R-squared       =     0.2887
                                                      Root MSE        =     29.517
    
    ------------------------------------------------------------------------------
                 |               Robust
            rent | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
         hsngval |   .0031938    .000738     4.33   0.000     .0017474    .0046402
        pcturban |  -.5064118   .5428297    -0.93   0.351    -1.570339    .5575149
           _cons |   113.8143   21.62169     5.26   0.000     71.43659    156.1921
    ------------------------------------------------------------------------------
    Endogenous: hsngval
    Exogenous:  pcturban faminc
    
    . regress rent pcturban hsngval, robust
    
    Linear regression                               Number of obs     =         50
                                                    F(2, 47)          =      34.47
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.6692
                                                    Root MSE          =     20.762
    
    ------------------------------------------------------------------------------
                 |               Robust
            rent | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
        pcturban |   .5248216    .309813     1.69   0.097    -.0984417    1.148085
         hsngval |   .0015205   .0004654     3.27   0.002     .0005842    .0024568
           _cons |   125.9033   12.60741     9.99   0.000     100.5405    151.2662
    ------------------------------------------------------------------------------
    
    . 
    . gmm (eq1: rent - {b1}*hsngval - {b2}*pcturban - {b0}) ///
    >     (eq2: rent - {xb: pcturban hsngval} - {c0}), ///
    >     instruments(eq1: pcturban faminc) ///
    >     instruments(eq2: pcturban hsngval) ///
    >     onestep winitial(unadjusted, indep)
    
    Step 1
    Iteration 0:  GMM criterion Q(b) =  111940.59  
    Iteration 1:  GMM criterion Q(b) =  3.320e-20  
    Iteration 2:  GMM criterion Q(b) =  3.397e-25  
    
    note: model is exactly identified.
    
    GMM estimation 
    
    Number of parameters =   6
    Number of moments    =   6
    Initial weight matrix: Unadjusted                 Number of obs   =         50
    
    ------------------------------------------------------------------------------
                 |               Robust
                 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    b1           |
           _cons |   .0031938   .0007379     4.33   0.000     .0017475    .0046402
    -------------+----------------------------------------------------------------
    b2           |
           _cons |  -.5064118    .542816    -0.93   0.351    -1.570312    .5574881
    -------------+----------------------------------------------------------------
    b0           |
           _cons |   113.8143   21.62145     5.26   0.000     71.43707    156.1916
    -------------+----------------------------------------------------------------
    xb           |
        pcturban |   .5248216   .3003665     1.75   0.081    -.0638859    1.113529
         hsngval |   .0015205   .0004512     3.37   0.001     .0006362    .0024049
    -------------+----------------------------------------------------------------
             /c0 |   125.9033   12.22331    10.30   0.000     101.9461    149.8606
    ------------------------------------------------------------------------------
    Instruments for equation eq1: pcturban faminc _cons
    Instruments for equation eq2: pcturban hsngval _cons

    Comment


    • #3
      Yiling: As an alternative to Andrew's helpful code, you can use the control function (CF) approach to estimation. This entails adding the first stage residuals to the OLS estimation of the equation of interest. You will reproduce the 2SLS estimate by including the CF. By dropping it, you get OLS.

      Code:
       reg small1 reaide1 ismall if star1 == 1
      predict vhat, resid
      reg averscore1 small1 reaide1 vhat if star1 == 1, cluster(schid1)
      The t statistic on vhat is the test you're looking for. It's the robust, variable addition version of the Hausman test.

      Comment


      • #4
        Dear Andrew and Jeff,

        Thank you for your useful commands! I really appreciate your kind help! One more question, in Andrew's code, should I look at the p-value of b1 and see whether it is smaller than 0.05? If it is, does that mean OLS and 2SLS's estimates are different at a 5% significant level?

        Thank you for your kind answer~ Have a nice day!

        Best,
        Yiling

        Comment


        • #5
          Also, just to share with you, I just figured out that we can use the estat endog command to test whether OLS and 2SLS estimates are different after running 2SLS regression (a quicker way to conduct the Hausman test). Thank you for your help again!

          Comment


          • #6
            I should’ve mentioned estat endog, which implements the short code I showed. I do like knowing the sign of the coefficient on vhat, and whether it’s practically large or small. We shouldn’t fixate on p-values.

            Comment


            • #7
              The suggestion was to combine gmm and test as below.

              Code:
              webuse hsng2, clear
              ivregress 2sls rent pcturban (hsngval = faminc), robust
              regress rent pcturban hsngval, robust
              
              gmm (eq1: rent - {xb1: hsngval pcturban} - {b0}) ///
                  (eq2: rent - {xb2: pcturban hsngval} - {c0}), ///
                  instruments(eq1: pcturban faminc) ///
                  instruments(eq2: pcturban hsngval) ///
                  onestep winitial(unadjusted, indep)
                  
              test _b[xb1:hsngval]=_b[xb2:hsngval]

              Comment


              • #8
                Thank you, Jeff and Andrew. I cannot thank you more.

                Comment

                Working...
                X