2 Star 7 Fork 0

李建成/计量经济学基本知识与STATA操作

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
2_IV_Estimation.do 3.16 KB
一键复制 编辑 原始数据 按行查看 历史
李建成 提交于 2022-04-12 17:04 . Stata
use "D:\BaiduNetdiskWorkspace\EDUCATION\Economics\Econometrics\Introductory Econometrics A Modern Approach_Wooldrige\stata伍德里奇\MROZ.DTA"
sum lwage educ
* OLS Estimation
reg lwage educ
* Source | SS df MS Number of obs = 428
*-------------+---------------------------------- F(1, 426) = 56.93
* Model | 26.3264193 1 26.3264193 Prob > F = 0.0000
* Residual | 197.001022 426 .462443713 R-squared = 0.1179
*-------------+---------------------------------- Adj R-squared = 0.1158
* Total | 223.327441 427 .523015084 Root MSE = .68003
*------------------------------------------------------------------------------
* lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
*-------------+----------------------------------------------------------------
* educ | .1086487 .0143998 7.55 0.000 .0803451 .1369523
* _cons | -.1851968 .1852259 -1.00 0.318 -.5492673 .1788736
*------------------------------------------------------------------------------
gen lneduc=ln(educ) //教育年限取对数
reg lwage lneduc
/*
Source | SS df MS Number of obs = 428
-------------+---------------------------------- F(1, 426) = 51.20
Model | 23.9593557 1 23.9593557 Prob > F = 0.0000
Residual | 199.368085 426 .4680002 R-squared = 0.1073
-------------+---------------------------------- Adj R-squared = 0.1052
Total | 223.327441 427 .523015084 Root MSE = .68411
------------------------------------------------------------------------------
lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lneduc | 1.256152 .1755609 7.16 0.000 .911079 1.601226
_cons | -1.976988 .4438785 -4.45 0.000 -2.849452 -1.104523
------------------------------------------------------------------------------
*/
* IV Estimation
ivreg2 lwage (educ = fatheduc)
*IV排他性约束
reg lwage educ fatheduc //fatheduc 的系数需要不显著,在控制educ的条件下
*IV-first stage
reg educ fatheduc
predict educ_hat1, xb //求拟合值
gen educ_hat2=9.799013+fatheduc*0.2824277
*IV-Second stage
reg lwage educ_hat2
*IV-opinon
ivreg2 lwage (educ = fatheduc) ,first //汇报第一阶段详细结果
ivreg2 lwage (educ = fatheduc) ,ffirst //汇报第一阶段建议结果
*If conditions
ivreg2 lwage (educ = fatheduc) if city==1,first
ivreg2 lwage (educ = fatheduc) if city==0,first
*Other Commands
ivreghdfe lwage (educ = fatheduc) ,first
**多元回归
*明瑟方程
reg lwage educ exper expersq //加入经验的平方
* lwage= -.0008112 *expersq+ .0415665*exper
twoway (qfit lwage exper) //绘图
gen educsq=educ*educ
gen fatheducsq=fatheduc*fatheduc
ivreg2 lwage exper expersq (educ educsq= fatheduc fatheducsq) //不是一个好的工具变量
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Lee_Jiancheng/Econometric_stata_ABC.git
git@gitee.com:Lee_Jiancheng/Econometric_stata_ABC.git
Lee_Jiancheng
Econometric_stata_ABC
计量经济学基本知识与STATA操作
master

搜索帮助