Code:
clear
input int(wave iid) float(ls income hs_work)
1 112 8 1000 20
1 111 7 1100 25
2 111 . 800 30
2 112 4 2000 15
3 112 7 1246 20
3 111 3 4589 18
4 112 4 2500 24
4 111 4 3000 40
5 112 8 1798 48
5 111 7 3251 40
6 112 8 3425 36
6 111 5 2000 38
end
xtset iid wave
bysort iid :egen double m_ls=mean(ls)
bysort iid :egen double m_income=mean(income)
bysort iid :egen double m_hs_work=mean(hs_work)
gen double dm_ls=ls-m_ls
gen double dm_income=income-m_income
gen double dm_hs_work=hs_work-m_hs_work
drop m_ls m_income m_hs_work
bysort wave:egen double m_ls=mean(dm_ls)
bysort wave:egen double m_income=mean(dm_income)
bysort wave:egen double m_hs_work=mean(dm_hs_work)
replace dm_ls=dm_ls-m_ls
replace dm_income=dm_income-m_income
replace dm_hs_work=dm_hs_work-m_hs_work
reg dm_ls dm_income dm_hs_work
forvalues i=1/6 {
qui {
drop m_ls m_income m_hs_work
bysort iid:egen double m_ls=mean(dm_ls)
bysort iid:egen double m_income=mean(dm_income)
bysort iid:egen double m_hs_work=mean(dm_hs_work)
replace dm_ls = dm_ls - m_ls
replace dm_income = dm_income - m_income
replace dm_hs_work = dm_hs_work - m_hs_work
sum dm_ls
drop m_ls m_income m_hs_work
bysort wave:egen double m_ls = mean(dm_ls)
bysort wave:egen double m_income = mean(dm_income)
bysort wave:egen double m_hs_work=mean(dm_hs_work)
replace dm_ls=dm_ls-m_ls
replace dm_income=dm_income-m_income
replace dm_hs_work=dm_hs_work-m_hs_work
}
reg dm_ls dm_income dm_hs_work
}Code:
reg dm_ls dm_income dm_hs_work
------------------------------------------------------------------------------
dm_ls | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
dm_income | -.0000895 .0003102 -0.29 0.780 -.0008048 .0006258
dm_hs_work | .0651194 .0593232 1.10 0.304 -.0716802 .201919
_cons | .037346 .2231589 0.17 0.871 -.4772595 .5519514
------------------------------------------------------------------------------
xtreg ls income hs_work, fe
------------------------------------------------------------------------------
ls | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
income | -.0007449 .0005059 -1.47 0.184 -.0019411 .0004513
hs_work | .0806055 .0485036 1.66 0.140 -.0340873 .1952984
_cons | 5.289379 1.874318 2.82 0.026 .8573201 9.721438
-------------+----------------------------------------------------------------
0 Response to Computing Fixed Effects Manually
Post a Comment