在一张图中绘制不同回归的边际效应
Plot the marginal effect of different regressions in one graph
我 运行 相同 probit
回归五次,但在不同的数据集上。
如何在同一张图上绘制每个回归的边际效应曲线,以便以简单的方式进行比较?
下面是我试过的代码:
probit one_y_unemp year* MR* AG* if Qualifica2 == 1
margins, dydx(year*) saving(me_intern, replace)
probit one_y_unemp year* MR* AG* if Qualifica3 == 1
margins, dydx(year*) saving(me_seniormanager, replace)
probit one_y_unemp year* MR* AG* if Qualifica4 == 1
margins, dydx(year*) saving(me_whitecollar, replace)
probit one_y_unemp year* MR* AG* if Qualifica5 == 1
margins, dydx(year*) saving(me_bluecollar, replace)
probit one_y_unemp year* MR* AG* if Qualifica6 == 1
margins, dydx(year*) saving(me_juniormanager, replace)
combomarginsplot me_intern me_seniormanager me_whitecollar me_bluecollar me_juniormanager, ///
labels("Intern" "Manager" "White Collar" "Blue Collar" "Junior Manager") xtitle("Years")
我在使用这段代码时遇到的问题是,我获得的图表不是每个专业角色都有一条曲线并且 x 轴上有年份虚拟变量,而是每个年份虚拟变量有一条线。
您可以使用社区贡献的命令coefplot
代替:
sysuse auto, clear
estimates clear
egen price2 = std(price)
egen rep782 = std(rep78)
replace rep782 = rep78 * -10
regress mpg i.foreign##c.price2 rep78
margins, dydx(foreign) at(price2=(-3(0.5)3)) post
estimates store m1
regress mpg i.foreign##c.rep782 price2
margins, dydx(foreign) at(rep782=(-3(0.5)3)) post
estimates store m2
coefplot m1 m2, at
我 运行 相同 probit
回归五次,但在不同的数据集上。
如何在同一张图上绘制每个回归的边际效应曲线,以便以简单的方式进行比较?
下面是我试过的代码:
probit one_y_unemp year* MR* AG* if Qualifica2 == 1
margins, dydx(year*) saving(me_intern, replace)
probit one_y_unemp year* MR* AG* if Qualifica3 == 1
margins, dydx(year*) saving(me_seniormanager, replace)
probit one_y_unemp year* MR* AG* if Qualifica4 == 1
margins, dydx(year*) saving(me_whitecollar, replace)
probit one_y_unemp year* MR* AG* if Qualifica5 == 1
margins, dydx(year*) saving(me_bluecollar, replace)
probit one_y_unemp year* MR* AG* if Qualifica6 == 1
margins, dydx(year*) saving(me_juniormanager, replace)
combomarginsplot me_intern me_seniormanager me_whitecollar me_bluecollar me_juniormanager, ///
labels("Intern" "Manager" "White Collar" "Blue Collar" "Junior Manager") xtitle("Years")
我在使用这段代码时遇到的问题是,我获得的图表不是每个专业角色都有一条曲线并且 x 轴上有年份虚拟变量,而是每个年份虚拟变量有一条线。
您可以使用社区贡献的命令coefplot
代替:
sysuse auto, clear
estimates clear
egen price2 = std(price)
egen rep782 = std(rep78)
replace rep782 = rep78 * -10
regress mpg i.foreign##c.price2 rep78
margins, dydx(foreign) at(price2=(-3(0.5)3)) post
estimates store m1
regress mpg i.foreign##c.rep782 price2
margins, dydx(foreign) at(rep782=(-3(0.5)3)) post
estimates store m2
coefplot m1 m2, at