刚看到一个帖子关于两阶段最小二乘法与工具变量的关系,因为觉得好,专门转载过来,也便于自己再看,陈强的虽然也是这么说,但理论部分还是这个英文的好懂。
Must I use all of my exogenous variables as instruments when estimating instrumental variables regression?| Title | | Two-stage least-squares regression |
| Author | Vince Wiggins, StataCorp |
来源:https://www.stata.com/support/fa ... riables-regression/
. regress y2 z1| Source |
| SS df MS
| Number of obs = 74 |
|
|
| F( 1, 72) = 71.41
|
| Model |
| 1216.67534 1 1216.67534
| Prob > F = 0.0000 |
| Residual |
| 1226.78412 72 17.0386683
| R-squared = 0.4979 |
|
|
| Adj R-squared = 0.4910
|
| Total |
| 2443.45946 73 33.4720474
| Root MSE = 4.1278 |
|
y2
|
| Coef. Std. Err. t P>|t| [95% Conf. Interval]
|
|
|
|
z1
|
| -.0444536 .0052606 -8.45 0.000 -.0549405 -.0339668
|
| _cons |
| 30.06788 1.143462 26.30 0.000 27.78843 32.34733
|
|
. predict double y2hat (option xb assumed; fitted values) * perform IV regression . regress y1 y2hat x1 Source
|
| SS df MS
| Number of obs = 74 |
|
|
| F( 2, 71) = 12.41
|
| Model |
| 164538571 2 82269285.5
| Prob > F = 0.0000 |
| Residual |
| 470526825 71 6627138.38
| R-squared = 0.2591 |
|
|
| Adj R-squared = 0.2382
|
| Total |
| 635065396 73 8699525.97
| Root MSE = 2574.3 |
|
y1
|
| Coef. Std. Err. t P>|t| [95% Conf. Interval]
|
|
|
|
y2hat
|
| -463.4688 117.187 -3.95 0.000 -697.1329 -229.8046
|
| x1 |
| -126.4979 108.7468 -1.16 0.249 -343.3328 90.33697
|
| _cons |
| 21051.36 6451.837 3.26 0.002 8186.762 33915.96
|
|
[size=14.6667px]Now we correct the variance–covariance by applying the correct mean squared error:
. rename y2hat y2hold . rename y2 y2hat . predict double res, residual . rename y2hat y2 /* put back real y2 */ . rename y2hold y2hat . replace res = res^2 (74 real changes made) . summarize res Variable
|
| Obs Mean Std. Dev. Min Max
|
|
|
|
res
|
| 74 7553657 1.43e+07 117.4375 1.06e+08
|
. scalar realmse = r(mean)*r(N)/e(df_r) /* much ado about small sample */ . matrix bmatrix = e(b) . matrix Vmatrix = e(V) . matrix Vmatrix = e(V) * realmse / e(rmse)^2 . ereturn post bmatrix Vmatrix, noclear . ereturn display
|
|
| Coef. Std. Err. t P>|t| [95% Conf. Interval]
|
|
|
|
y2hat
|
| -463.4688 127.7267 -3.63 0.001 -718.1485 -208.789
|
| x1 |
| -126.4979 118.5274 -1.07 0.289 -362.8348 109.8389
|
| _cons |
| 21051.36 7032.111 2.99 0.004 7029.73 35072.99
|
|
ReferenceBaltagi, B. H. 2011.Econometrics. New York: Springer.