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]
RE: st: RE: marginsplot is acting differently
From
Richard Williams <[email protected]>
To
[email protected], <[email protected]>
Subject
RE: st: RE: marginsplot is acting differently
Date
Sat, 31 Dec 2011 14:50:44 -0500
At 05:58 AM 12/31/2011, Philip Ryan wrote:
<<>>
Richard,
Further to our discussion on the behaviour of -marginsplot-, try this
(apologies in advance if line endings are zapped):
webuse nhanes2f, clear
logit diabetes i.black i.female age, nolog
margins, dydx(black female) at(age=(20 30 40 50 60 70)) vsquish
marginsplot, noci
margins r.black r.female, at(age= (20 30 40 50 60 70)) vsquish
marginsplot, noci
The first -margins/marginsplot- sequence is as you tried, and yields the
unwanted base level lines. The second is the alternative discussed on pages
1113-1114 of the manual and _should_ give "an identical graph" (para 1 page
1114), but this syntax yields a graph that omits the unwanted lines.
I don't know whether the first syntax's production of the base level lines
is a feature or a bug, but it doesn't appear to be consistent with (my
reading of) the manual.
Phil
Good catch Phil! Here is the code from that section of the manual,
and, despite what the manual says, the two graphs are clearly NOT
identical. The 2nd one has the same weird problem that I had, i.e. it
presents a nonsensical line for the base category that is the same as
the x-axis.
use http://www.stata-press.com/data/r12/nhanes2, clear
logistic highbp sex##agegrp##c.bmi
margins r.sex, at(bmi=(10(1)65))
marginsplot, xlabel(10(10)60) recast(line) recastci(rarea)
margins, at(bmi=(10(1)65)) dydx(sex)
marginsplot, xlabel(10(10)60) recast(line) recastci(rarea)
Given the apparent contradiction with the manual, it is even harder
for me to believe that this is a "feature" rather than a bug.
Further, I know I was getting the graph I wanted and expected back in
September, and I can't think of any good reason that you would want
to include base-level lines when they are the exact same as the
X-axis. I also prefer the way the margins output is formatted with my
preferred syntax, although, as the manual notes, such preferences are
discipline-specific.
Nonetheless, unless or until my preferred syntax starts working the
way I want it to, it is nice to know there is such a relatively
painless work-around. Thanks!
-------------------------------------------
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/