Last active
December 22, 2016 21:07
-
-
Save tyleransom/153326be8c4b258411113a7f7cf0a2a2 to your computer and use it in GitHub Desktop.
How to compute counterfactual predictions in Stata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sysuse auto, clear | |
logit foreign i.rep78 c.price c.mpg | |
predict base if e(sample), pr | |
preserve | |
clonevar oldrep78 = rep78 | |
replace rep78 = 4 | |
predict new if e(sample), pr | |
generat mfx = new-base | |
replace rep78 = oldrep78 | |
tab rep78 , sum(mfx) | |
restore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment