forvaluest=2001/2008{quiregyxifyear==`t'eststorer_`t'}然后不小心看到了一位大神的三种方法....没试过先mark
三种策略,建议你都试试:(1)直接用outreg2的一项功能,//helpoutreg2##s_1
bysortcompliance:outreg2usingc3.doc,replace:regarestimesizeROAgrowthlevprofquality(2)直接用outreg2的另一项功能,//helpoutreg2##s_2
levelsofcompliance,local(cl)//helplevelsofcaperasec3.docforeachlvoflocalcl{regarestimesizeROAgrowthlevprofqualityifcompliance==`lv'outreg2usingc3.doc}(3)手工循环(估计->保存估计结果)->统一输出
levelsofcompliance,local(cl)foreachlvoflocalcl{regarestimesizeROAgrowthlevprofqualityifcompliance==`lv'eststorecl_`lv'}outreg2[cl_*]usingc3.doc,replace2.交叉项
genicv可以一键生成很多交叉项##可以直接表示交叉项。【例子】sscinstallgenicvsysuseauto,cleargenicvlengthweightforeign\\\会生成4个交叉项,所以可能情况,并且有labelregpricelengthweightlength_weight*如果不愿意生成,直接用regpricec.length##c.weight\\\和上面回归一样一样的3.工具变量
imr=normalden(predict)/normal(predict)两阶段回归ivreg2roasdsizeagestateindratiohold_share_wincome_increase_w(vc=htvc_denyoung)
3.群聚调整
regyx,cluster(code)4.内生性问题——heckman两阶段回归
5.回归结果导出
outreg2[model1model2model3]using"C:\Users\ASUS\Desktop\myfile",tstate(r2_a,F)bdec(3)tdec(2)5.回归残差保存
regyx1x2predicte,r
xbxb,fittedvalues;thedefaultstdpcalculatestandarderrorofthefittedvaluesueu_i+e_it,thecombinedresidual*xbuxb+u_i,predictionincludingeffect*uu_i,thefixed-orrandom-errorcomponent*ee_it,theoverallerrorcomponent如果用e,得出的结果是每个公司每年的残差都不同,如果用u,则是同一个公司不同年度的残差是一样的
因为u是个体效应,e是真正的残差项,区别就在于用FE还是RE时地位不同