Marginal effects
发布时间:2026-08-29 | 浏览:1
Login or Register Log in with
Forums for Discussing Stata
You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ .
Latest Activity
Li Mueller Join Date: Feb 2016 Posts: 16 #1 Marginal effects - Probit 15 Mar 2016, 08:58 Hi all, I did a probit regression (dependent (binary) variable: withdrawal or not) and now want to get the marginal effects to better interpret the model (I am using Stata 13.1). I used . mfx compute but realized that it is slightly old and instead wanted to use . margins, dydx(*) Since I got two different results, I was wondering which command is the correct one. What I want to get is the change in the withdrawal probability given a change in the independent variable. I also have dummy variables in my regression and am not sure if I need to consider this when calculating the marginal effects. Any help on the topic is appreciated! Tags: None
Join Date: Feb 2016
Marginal effects - Probit
Clyde Schechter Join Date: Apr 2014 Posts: 30367 #2 15 Mar 2016, 09:58 I can't comment about -mfx-. It's an old command, and I have never used it. I don't know what its results might mean. As for -margins, dydx()-, it does treat dichotomous ("dummy") variables differently from continuous ones if you properly designated them in your model. So, if you did Code: probit outcome var1 var2 i.var3 var4 // etc. margins, dydx(*) then -margins- will know that var3 is represented by a series of one or more indicator variables. For such indicators it will calculate the expected change in outcome probability associated with a discrete one unit increase in the indicator, with all other variables set to their actual values in the data set. If you did not specify the i. (or if you did so but overrode it with the obsolete -xi:- prefix) then -margins- will not know that these are indicator variables and will instead give you its calculation of the first derivative of the outcome probability with respect to var3 (assumed to be continuous), again with all other variables set to their actual values in the data set. Notes: 1. The all other variable set to their actual values in the data set part can be overridden with at() options if you prefer to specify otherwise. 2. I have assumed that you literally used the -probit- command. If you ran -ivprobit- or -xtprobit-, then -margins- calculates marginal effect on xb by default, not on predicted probability. (But you can get predicted probability by specifying the -predict(pr)- option. -mfx- was around for a long time, so it is likely that most of its bugs or errors were worked out long ago. So it is not a question of which one is correct. Both are giving correct answers, but probably are answering different questions. I've outlined above the questions that -margins- answers--and how it depends on what your -probit- command looked like. I don't know what question -mfx- answers. And, of course, only you know which question you actually wanted to ask. 1 like Comment Post Cancel
Join Date: Apr 2014
Richard Williams Join Date: Apr 2014 Posts: 5044 #3 15 Mar 2016, 12:15 I don't have Stata handy but I think if you added the atmeans option to margins the two would match up pretty well. Any other differences might be due to one command treating a dichotomy as categorical while the other treated it as continuous, but there are ways to fix that too. ------------------------------------------- Richard Williams Professor Emeritus of Sociology University of Notre Dame StataNow Version: 19.5 MP (2 processor) EMAIL: [email protected] WWW: https://academicweb.nd.edu/~rwilliam/ 1 like Comment Post Cancel
Join Date: Apr 2014
Li Mueller Join Date: Feb 2016 Posts: 16 #4 15 Mar 2016, 15:24 Thanks Clyde and Richard for your input! Richard, I tried to specify the atmeans option, but I don't get the same results. I specified the "i" for the dummies, like Clyde suggested and tried running the mfx command again and got the following error message: default predict() is unsuitable for marginal-effect calculation. I now ran a new probit regression (excerpt): probit withdrawn log_filing_size i.ff_tech_dummy i.vc_dummy .margins, dydx(*) My results look the following now (excerpt): | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------------+---------------------------------------------------------------- log_filing_size | -.0169683 .0016812 -10.09 0.000 -.0202635 -.0136732 1.ff_tech_dummy | -.012848 .007352 -1.75 0.081 -.0272577 .0015618 1.vc_dummy | -.0412084 .0049348 -8.35 0.000 -.0508804 -.0315363 Is my interpretation right that a one unit change in log_filing_size decreases the withdrawal probability (dependent variable) by 0.0169? Comment Post Cancel
Join Date: Feb 2016
Clyde Schechter Join Date: Apr 2014 Posts: 30367 #5 15 Mar 2016, 16:02 First, sorry if my suggestion was confusing. I didn't mean to use factor variable notation for the -mfx- command: it's an older command and doesn't work with factor variable notation. I meant it only as applied to model you would follow with -margins-. I think for -mfx- you have to back to the old-fashioned approach. You did run that as I had imagined, and your interpretation of the results is pretty much correct. The only thing I would do is qualify that to say that that's the marginal effect of a unit change in log_filing_size on probability of outcome conditional on the distribution of all the model variables being what they are in the data set . With non-linear models like logit or probit you always have to be careful to condition estimates of marginal effect on probability on whatever values were actually used to calculate them. Comment Post Cancel
Join Date: Apr 2014
Li Mueller Join Date: Feb 2016 Posts: 16 #6 15 Mar 2016, 16:14 Perfect, I understand! Thanks so much for your help & effort! Comment Post Cancel
Join Date: Feb 2016
Richard Williams Join Date: Apr 2014 Posts: 5044 #7 16 Mar 2016, 05:35 Li, I don't know exactly what you did since you didn't show all your commands and output (please see #12 in the FAQ for instructions on doing so) but here is an example of what I was talking about. But in any event, it is better to use margins anyway. Code: . webuse nhanes2f, clear . logit diabetes weight height, nolog Logistic regression Number of obs = 10,335 LR chi2(2) = 130.28 Prob > chi2 = 0.0000 Log likelihood = -1933.9288 Pseudo R2 = 0.0326 ------------------------------------------------------------------------------ diabetes | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- weight | .0301604 .0028288 10.66 0.000 .0246161 .0357048 height | -.0473011 .0052236 -9.06 0.000 -.0575391 -.0370631 _cons | 2.671749 .8062233 3.31 0.001 1.09158 4.251917 ------------------------------------------------------------------------------ . mfx Marginal effects after logit y = Pr(diabetes) (predict) = .04353047 ------------------------------------------------------------------------------ variable | dy/dx Std. Err. z P>|z| [ 95% C.I. ] X ---------+-------------------------------------------------------------------- weight | .0012557 .00011 11.09 0.000 .001034 .001478 71.9031 height | -.0019694 .00021 -9.46 0.000 -.002377 -.001561 167.653 ------------------------------------------------------------------------------ . margins, dydx(*) atmeans Conditional marginal effects Number of obs = 10,335 Model VCE : OIM Expression : Pr(diabetes), predict() dy/dx w.r.t. : weight height at : weight = 71.90313 (mean) height = 167.653 (mean) ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- weight | .0012557 .0001132 11.09 0.000 .0010338 .0014777 height | -.0019694 .0002081 -9.46 0.000 -.0023774 -.0015615 ------------------------------------------------------------------------------ ------------------------------------------- Richard Williams Professor Emeritus of Sociology University of Notre Dame StataNow Version: 19.5 MP (2 processor) EMAIL: [email protected] WWW: https://academicweb.nd.edu/~rwilliam/ Comment Post Cancel
Join Date: Apr 2014
Li Mueller Join Date: Feb 2016 Posts: 16 #8 17 Mar 2016, 13:34 Sorry, Richard! I just tried to use the margins atmeans option again and it worked. You are right! I know, it's a little off topic, but maybe you can help me regarding robustness checks for a probit model: Is it possible to use the commands rcheck or checkrob for a probit model, too? Or are there any other useful Stata commands for this purpose? Comment Post Cancel
Join Date: Feb 2016
© Copyright StataCorp LLC Terms of use Privacy Help Contact Us
© Copyright StataCorp LLC Terms of use Privacy Help Contact Us
© Copyright StataCorp LLC