[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Maarten buis <[email protected]> |

To |
stata list <[email protected]> |

Subject |
st: RE: marginal effect |

Date |
Mon, 18 Feb 2008 15:45:33 +0000 (GMT) |

--- Jason Franken wrote: > I've seen that you answer many questions on the STATA listserve (but > I'm not sure how to post my question, so I'm emailing you instead). This is discussed here: http://www.stata.com/support/faqs/res/statalist.html#toask > I'm trying to reproduce the marginal effects computed by the mfx (or > margeff) command by using the nlcom and predictnl commands. Code > follows: <snip> > The mfx command says the marginal effect of x1 at mean values of the > data is 0.09***, whereas the margeff command says that the sample > average marginal effect of x1 is 0.06***. Both the nlcom and > predictnl commands say the marginal effect of x1 at mean values of > the data is 0.015 and statistically insignificant. How can I > reconcile the different results for mfx and predictnl (or nlcom) > commands (am I using them incorrectly)? -mfx- and -margeff- do something subtly different different: -mfx- computes the marginal effects at the mean values of your explanatory variables, while -margeff- computes the marginal effect for each individual and than computes the mean of these marginal effects. So these two commands should yield (slightly) different numbers. In the example below, I was able to exactly reproduce the -mfx- with -nlcom-, and I could get close (upto 4 digits) with -margeff- (but maybe Tamas could comment on that). I am also not sure how the standard errors are calculated in -margeff- (this says nothing about the quality of -margeff- and everything about my lack of knowledge). *-------------------- begin example -------------------- sysuse auto, clear logit foreign mpg length tempname mpg length xb sum mpg scalar `mpg' = r(mean) sum length scalar `length' =r(mean) local xb "(_b[_cons] + _b[mpg]*`mpg' + _b[length]*`length')" nlcom (mpg: invlogit(`xb')*invlogit(-1*`xb')*_b[mpg]) /// (length: invlogit(`xb')*invlogit(-1*`xb')*_b[length]) mfx predict double xb if e(sample), xb gen double mfx_mpg = invlogit(xb) * invlogit(-xb) * _b[mpg] gen double mfx_length = invlogit(xb) * invlogit(-xb) * _b[length] sum mfx* margeff *------------------------ end example ----------------------------- (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room Z434 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- ___________________________________________________________ Support the World Aids Awareness campaign this month with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/ * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: RE: marginal effect***From:*"Tamas Bartus (tbartus)" <[email protected]>

- Prev by Date:
**st: exact poisson regression** - Next by Date:
**Re: Re: Re: st: I can't get fs to work from inside a do file** - Previous by thread:
**st:How to input a portion of a file** - Next by thread:
**st: RE: marginal effect** - Index(es):

© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |