Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: problem running mfx after glm


From   Richard Williams <richardwilliams.ndu@gmail.com>
To   statalist@hsphsun2.harvard.edu, "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: problem running mfx after glm
Date   Mon, 15 Aug 2011 19:19:33 -0500

At 05:27 PM 8/15/2011, Marlis Gonzalez Fernandez wrote:
Hello-

Did the following analysis last fall:

glm  ReadingCompCombdiv100 education, family(binomial) link(logit) robust

followed by:

mfx, at(mean)

This provided me with the marginal effects after glm (variable of interest is a proportion).

Any idea why this is giving me a problem.having trouble figuring out how to do this using margins instead of mfx.

Here is a simple example, that should work in Stata 11 or later:

use "http://www.indiana.edu/~jslsoc/stata/spex_data/ordwarm2.dta";, clear
glm  warmlt3 yr89 male white age ed prst, link(logit) family(binomial) robust
mfx, at(mean)
glm warmlt3 i.yr89 i.male i.white age ed prst, link(logit) family(binomial) robust
margins, dydx(*) atmeans

Note how, the 2nd time around, I added the i. before the names of the categorical independent variables. This is necessary so that margins will know they are categorical; otherwise it would treat them as continuous when computing the marginal effects.

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index