Vincenzoalfano
Vincenzoalfano

Reputation: 162

Plot the marginal effect of different regressions in one graph

I am running the same probit regression five times but on different sets of data.

How can I plot the curve of the marginal effects for each regression on the same graph to compare them in an easy way?

Below is the code I have tried:

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")

The problem I have with this code is that the graph I obtain, instead of having one curve for each professional role and having the year dummies on the x-axis, has one line per each year dummy.

Upvotes: 2

Views: 586

Answers (1)

user8682794
user8682794

Reputation:

You can use the community-contributed command coefplot instead:

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

enter image description here

Upvotes: 5

Related Questions