全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
2547 4
2013-01-06
y是消费,x是收入
这是老师给代码, 其中关于一句命令 gen w=1/(exp(0.5*f)) 完全看不懂,比如为什么是0.5,请各位同学解答一下,谢谢
reg y x
estat hettest x, fstat
predict e, residuals
gen e2=e^2
reg e2 x
reg y x, robust

gen le2=ln(e2)
predict xb, xb
gen xb2=xb^2
reg le2 xb xb2
predict f, xb
gen w=1/(exp(0.5*f))
gen ys=y*w
gen xs=x*w
reg ys xs w, noconstant robust
more


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-1-6 09:40:23
reg y x
estat hettest x, fstat //White test
predict e, residuals //get ols residule
gen e2=e^2  //gen residule square
reg e2 x
reg y x, robust

gen le2=ln(e2)
predict xb, xb
gen xb2=xb^2  
reg le2 xb xb2  //regress ols residule square on fitted values
predict f, xb //get the "true" error terms square
gen w=1/(exp(0.5*f)) //get the weight for GLS
gen ys=y*w
gen xs=x*w
reg ys xs w, noconstant robust
more


/*the logic see below
e2 is not qualified for OLS regression because it includes some information caused by x;
thus according to woodbridge,
e2=omega*exp(X), or take log to estimate:
ln(e2)=const+ xb+xb2+error or ln(e2)=const+ xb+error;
you can get ln(e2)hat, which is the weight*/
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-1-7 21:30:44
fgleric 发表于 2013-1-6 09:40
reg y x
estat hettest x, fstat //White test
predict e, residuals //get ols residule
thank u for the nice reply, but I still cant understand why there is a 0.5, why not 0.6 or and so on, according to your word, it is  from woodbridge, could u paraphrase it for me, it will be perfect. thanks a lot.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-1-7 23:36:46
Les_mauvais 发表于 2013-1-7 21:30
thank u for the nice reply, but I still cant understand why there is a 0.5, why not 0.6 or and so  ...
sorry the book is not at hand now.
0.5 is for sq root, remember that f is predicted e^2; and theoretically var(e|x)=omega^2*pi while pi can writted as p'p=inv(pi).

This is why your prof use 0.5 to get sq root value of f (predicted e^2).
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-1-10 08:44:30
fgleric 发表于 2013-1-7 23:36
sorry the book is not at hand now.
0.5 is for sq root, remember that f is predicted e^2; and theo ...
thanks a lot, this is quite useful!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群