You can estimate the model, predict
, change x with replace
, and predict
again. Then you can calculate the differences between the two predictions to get the marginal effects. You can change x by 1 or by a small amount epsilon (which will approximate what margins calculates much better). The first version will obviously be larger.
Here's an example using the cars data:
set more off
sysuse auto, clear
keep foreign mpg rep78 make
clonevar orig_rep78 = rep78
probit foreign mpg rep78
margins, dydx(rep78)
predict phat, pr
replace rep78 = rep78 + 1
predict phat_plus_one, pr
gen double finite_diff = phat_plus_one - phat
replace rep78 = orig_rep78 + 0.01
predict phat_plus_eps, pr
gen double eps_diff = (phat_plus_eps - phat)/.01
drop rep78
rename orig_rep78 rep78
tw (scatter finite_diff mpg) (scatter eps_diff mpg)
sum *_diff
You can see that the eps version matches the margins output more closely. You might want to see how sensitive your estimates are to different values of epsilon.
I don't know what sort of graph you had in mind, so I just plotted the MEs against the other regressor. You can see that the ME is increasing in mpg, which makes sense since the index function coefficients are all positive. The low values for mpg above 30 make sense since the predicted probability is already near 1, so additional repairs can't raise it all that much.