字符串转化为数值型
encode y,gen(y1)
或destring y ,replace
描述性统计
outreg2 using xx.rtf,replace sum(log) keep(y x1 x2)
相关性分析
asdoc power (变量名称) ,star (all) nonum replace
将数据转化成面板数据
xtset (样本个体 时间)
转化为平衡面板
xtbalance,range(t1,t2)
生成时间虚拟变量
tab year , gen (year)
检测时间效应是否显著
test year2 year3 ...
豪斯曼检验
xtreg y x1 x2 x3 i.year,fe
est store fe
xtreg y x1 x2 x3 i.year,re
hausman fe,constant sigmamore
(P值为0,则在0.01的显著水平下拒绝原假设,选择固定效应模型)
固定效应模型
xtreg y1 x1 x2 i.year,fe
或xtreg y1 x1 x2 year2-yeari,fe
将回归结果储存到y1
est store y1
输出回归结果
esttab y1 y2 using xxx.rtf,replace b(%12.3f) se(%12.3f) nogap compress s(N r2) star(* 0.1 ** 0.05 *** 0.01)
每个样本的某变量时间序列图
xtline y
每个样本的某变量时间序列图,合并在一张图上
xtline y ,overlay
中介效应
https://zhuanlan.zhihu.com/p/99435552


雷达卡





京公网安备 11010802022788号







