Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Graphic displays or results from margins
From 
 
Richard Williams <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: Graphic displays or results from margins 
Date 
 
Mon, 20 Sep 2010 10:32:32 -0500 
I am warming up to the new margins command.  However, unlike the 
older adjust command, margins does not include the ability to 
generate new variables. I am therefore finding it hard to create 
graphic displays of the results.
Consider the following:
webuse nhanes2f, clear
logit diabetes i.black i.female age i.female#c.age, nolog
margins female#black, at(age = (20(10)70))
I would love to create a graphic where the Y axis was the probability 
of diabetes, the X axis was age, and there were 4 separate lines, for 
black males, black females, nonblack males, nonblack females. I 
imagine I could generate variables myself (basically replicating what 
margins is doing) or (ugh!) cut and paste results into an excel 
spreadsheet. But, is there some nice, simple approach for doing this? 
The prgen command in Long & Freese's spost9 suite of commands can do 
things like this, but it doesn't support many of the features of 
margins, e.g. it doesn't work with factor variables, and things like 
interaction terms are going to confuse it.
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
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/