STATA

 


 

*others
cd "D:\桌面\
use "D:\桌面\1.dta"
clear all

*dealing with data
egen country = group( LOCATION )
encode country, gen ( time)
destring country, replace
drop frequency 
rename time country
merge m:m year country using "D:\桌面\7.dta",keep(match) nogenerate
egen id = group(Year)
gen InternetEffectiveness = Internet*Effectiveness
gen trade_gdp=trade/gdp
duplicates drop Country Year, force
tsset  Country Year
ssc install xtbalance
xtbalance,range(2009 2015)
ssc install asdoc
help ihstrans
ssc install ihstrans
ssc install xtavplot
asdoc sum

*regression1
xtset country year
xtreg trade_gdp  c.internet##c.effectiveness ,fe
est store f1
lincom internet + c.internet#c.effectiveness
xtreg trade_gdp  c.internet##c.effectiveness i.year ,fe
est store f2
lincom internet + c.internet#c.effectiveness
xtreg trade_gdp  c.internet##c.effectiveness i.year population education,fe
est store f3
lincom internet + c.internet#c.effectiveness
outreg2 [f1 f2 f3] using test1.doc,replace


xtavplot c.internet#c.effectiveness
test internet c.internet#c.effectiveness
hist trade_gdp

*regression2
xtreg trade_gdp  c.internet##c.stability ,fe
est store f4
lincom internet + c.internet#c.stability
xtreg trade_gdp  c.internet##c.stability i.year ,fe
est store f5
lincom internet + c.internet#c.stability
xtreg trade_gdp  c.internet##c.stability i.year population education,fe
est store f6
lincom internet + c.internet#c.stability
outreg2 [f4 f5 f6] using test2.doc,replace

xtavplot c.internet#c.stability
test internet c.internet#c.stability
hist trade_gdp

*regression3
xtreg trade_gdp  c.internet##c.law ,fe
est store f7
lincom internet + c.internet#c.law
xtreg trade_gdp  c.internet##c.law i.year ,fe
est store f8
lincom internet + c.internet#c.law
xtreg trade_gdp  c.internet##c.law i.year population education,fe
est store f9
lincom internet + c.internet#c.law
outreg2 [f7 f8 f9] using test3.doc,replace

xtavplot c.internet#c.law
test internet c.internet#c.law
hist trade_gdp

*robust
*gen lntrade_gdp=ln(trade_gdp) will loseing obvs,so ihstrans
ihstrans trade_gdp
rename ihs_trade_gdp lntrade_gdp

*robust regression 
*regression4
xtset country year
xtreg lntrade_gdp  c.internet##c.effectiveness ,fe
est store f1
lincom internet + c.internet#c.effectiveness
xtreg lntrade_gdp  c.internet##c.effectiveness i.year ,fe
est store f2
lincom internet + c.internet#c.effectiveness
xtreg lntrade_gdp  c.internet##c.effectiveness i.year population education,fe
est store f3
lincom internet + c.internet#c.effectiveness
outreg2 [f1 f2 f3] using test4.doc,replace

xtavplot c.internet#c.effectiveness
test internet c.internet#c.effectiveness
hist lntrade_gdp

*regression5
xtreg lntrade_gdp  c.internet##c.stability ,fe
est store f4
lincom internet + c.internet#c.stability
xtreg lntrade_gdp  c.internet##c.stability i.year ,fe
est store f5
lincom internet + c.internet#c.stability
xtreg lntrade_gdp  c.internet##c.stability i.year population education,fe
est store f6
lincom internet + c.internet#c.stability
outreg2 [f4 f5 f6] using test5.doc,replace

xtavplot c.internet#c.stability
test internet c.internet#c.stability
hist lntrade_gdp

*regression6
xtreg lntrade_gdp  c.internet##c.law ,fe
est store f7
lincom internet + c.internet#c.law
xtreg lntrade_gdp  c.internet##c.law i.year ,fe
est store f8
lincom internet + c.internet#c.law
xtreg lntrade_gdp  c.internet##c.law i.year population education,fe
est store f9
lincom internet + c.internet#c.law
outreg2 [f7 f8 f9] using test6.doc,replace

xtavplot c.internet#c.law
test internet c.internet#c.law
hist lntrade_gdp






 

你可能感兴趣的:(stata,statistics)