set more off
use dta1
encode country, generate(cm) label(cm) 因为一般的country变量是红色的 无法设置面板 因此要encode一下
xtset cm year
然后自己加变量 xtreg y x1 x2,fe ; xtreg yx1 x2 re
然后hausman 检验
/***********************检验到底用混合回归还是固定效应回归******这里看固定效用下面F检验,如果拒绝就应该选择则固定效应模型************************************************/
reg y x1 x2,vce(cluster prov)
estimates store ols
xtreg y x1 x2,fe vce(cluster prov)
estimates store FE_robust
/*********************检验用固定效应回归还是用随机效应*******************看hausman结果,拒绝用固定效应********************************/
xtreg y x1 x2,fe
estimates store FE
xtreg y x1 x2,re
estimates store RE
hausman FE RE,constant sigmamore