第11章のStataコード

第11章 操作変数法

サンプルデータ

cigarette.csv:母親の喫煙と新生児の出生体重に関する架空データ.

proximity.csv:Card (1995)のデータ.

11.2 操作変数法の実施:2段階最小二乗法

11.2.1 2段階最小二乗法

import delimited "cigarette.csv", case(preserve) clear 

regress bw cigpacks
      Source |       SS           df       MS      Number of obs   =     1,000
-------------+----------------------------------   F(1, 998)       =   1632.56
       Model |  83763793.8         1  83763793.8   Prob > F        =    0.0000
    Residual |  51205762.7       998  51308.3795   R-squared       =    0.6206
-------------+----------------------------------   Adj R-squared   =    0.6202
       Total |   134969557       999  135104.661   Root MSE        =    226.51

------------------------------------------------------------------------------
          bw | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
    cigpacks |  -62.40191   1.544414   -40.40   0.000    -65.43258   -59.37124
       _cons |   3423.228   17.02299   201.09   0.000     3389.823    3456.633
------------------------------------------------------------------------------
quietly regress cigpacks price
predict fitted, xb
regress bw fitted
      Source |       SS           df       MS      Number of obs   =     1,000
-------------+----------------------------------   F(1, 998)       =    686.04
       Model |  54983766.9         1  54983766.9   Prob > F        =    0.0000
    Residual |  79985789.6       998  80146.0818   R-squared       =    0.4074
-------------+----------------------------------   Adj R-squared   =    0.4068
       Total |   134969557       999  135104.661   Root MSE        =     283.1

------------------------------------------------------------------------------
          bw | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fitted |  -53.26758     2.0337   -26.19   0.000     -57.2584   -49.27676
       _cons |   3331.894   22.21839   149.96   0.000     3288.294    3375.494
------------------------------------------------------------------------------

Rによるデータ演習

import delimited "proximity.csv", case(preserve) clear 

list in 1/4
     +---------------------------------------------------------+
     |    lwage   educ   exper   black   south   smsa   nearc4 |
     |---------------------------------------------------------|
  1. | 6.306275      7      16       1       0      1        0 |
  2. | 6.175867     12       9       0       0      1        0 |
  3. | 6.580639     12      16       0       0      1        0 |
  4. | 5.521461     11      10       0       0      1        1 |
     +---------------------------------------------------------+
regress lwage educ exper black south smsa
estimates store OLS
      Source |       SS           df       MS      Number of obs   =     3,010
-------------+----------------------------------   F(5, 3004)      =    232.21
       Model |  165.205668         5  33.0411336   Prob > F        =    0.0000
    Residual |  427.435978     3,004  .142288941   R-squared       =    0.2788
-------------+----------------------------------   Adj R-squared   =    0.2776
       Total |  592.641646     3,009  .196956346   Root MSE        =    .37721

------------------------------------------------------------------------------
       lwage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        educ |    .073807   .0035336    20.89   0.000     .0668784    .0807356
       exper |   .0393134   .0021955    17.91   0.000     .0350085    .0436183
       black |  -.1882225   .0177678   -10.59   0.000    -.2230607   -.1533843
       south |  -.1290528   .0152285    -8.47   0.000    -.1589122   -.0991935
        smsa |   .1647411   .0156919    10.50   0.000     .1339732     .195509
       _cons |   4.913331   .0631212    77.84   0.000     4.789566    5.037096
------------------------------------------------------------------------------
ivregress 2sls lwage exper black south smsa (educ = nearc4)
estimates store TSLS
Instrumental variables 2SLS regression            Number of obs   =      3,010
                                                  Wald chi2(5)    =     673.47
                                                  Prob > chi2     =     0.0000
                                                  R-squared       =     0.2140
                                                  Root MSE        =      .3934

------------------------------------------------------------------------------
       lwage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
        educ |   .1318498   .0495237     2.66   0.008     .0347852    .2289144
       exper |   .0622698   .0196665     3.17   0.002     .0237241    .1008156
       black |  -.1296012   .0532094    -2.44   0.015    -.2338897   -.0253128
       south |  -.1092522   .0231533    -4.72   0.000    -.1546318   -.0638725
        smsa |   .1348259   .0302606     4.46   0.000     .0755162    .1941356
       _cons |   3.939822   .8309333     4.74   0.000     2.311222    5.568421
------------------------------------------------------------------------------
Instrumented: educ
 Instruments: exper black south smsa nearc4
etable, estimates(OLS TSLS) showstars showstarsnote column(estimates) title(Dpendent Var. = Log of Wage)
Dpendent Var. = Log of Wage
--------------------------------------------
                           OLS       TSLS   
--------------------------------------------
educ                     0.074 **   0.132 **
                       (0.004)    (0.050)   
exper                    0.039 **   0.062 **
                       (0.002)    (0.020)   
black                   -0.188 **  -0.130 * 
                       (0.018)    (0.053)   
south                   -0.129 **  -0.109 **
                       (0.015)    (0.023)   
smsa                     0.165 **   0.135 **
                       (0.016)    (0.030)   
Intercept                4.913 **   3.940 **
                       (0.063)    (0.831)   
Number of observations    3010       3010   
--------------------------------------------
** p<.01, * p<.05