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]

From |
Alex Gamma <alex.gamma@uzh.ch> |

To |
statalist <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: Graphic displays or results from margins |

Date |
Mon, 20 Sep 2010 21:26:30 +0200 |

Scott Merryman: > > It would be nice to extract the information in the r(b) matrix to > relabel the legend, but I am not sure how. -matnames- (on SSC) seems to do what you want: TITLE 'MATNAMES': module to return matrix row and column names DESCRIPTION/AUTHOR(S) matnames returns matrix row and column names as locals in r(). The macro extended functions that retrieve matrix row and column names do not quote the names, so that if names contain spaces, the number of tokens may not match the number of rows or columns (that is, you may not be able to rename the matrix rows or columns with its own names that you just retrieved). matnames uses the Mata functions st_matrixrowstripe and st_matrixcolstripe to circumvent this difficulty. KW: matrix KW: names KW: row KW: column Requires: Stata version 9.2 Distribution-Date: 20090712 Author: Austin Nichols Support: email austinnichols@gmail.com INSTALLATION FILES (type net install matnames) matnames.ado matnames.hlp ----- Original Message ----- From: "Scott Merryman" <scott.merryman@gmail.com> To: <statalist@hsphsun2.harvard.edu> Sent: Monday, September 20, 2010 5:24 PM Subject: Re: st: Graphic displays or results from margins -margins- does have the post option. As start, you could do something this: webuse nhanes2f, clear logit diabetes i.black i.female age i.female#c.age, nolog margins female#black, at(age = (20(10)70)) post matrix b = r(b) matrix at = r(at) mata b =st_matrix("b") b = rowshape(b,6) st_matrix("b", b) end clear svmat at svmat b line b* at5 It would be nice to extract the information in the r(b) matrix to relabel the legend, but I am not sure how. Scott On Mon, Sep 20, 2010 at 10:32 AM, Richard Williams <richardwilliams.ndu@gmail.com> wrote: > 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: 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/ > * * 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/ Am 20.09.2010 um 17:24 schrieb Scott Merryman: > -margins- does have the post option. > > As start, you could do something this: > > webuse nhanes2f, clear > logit diabetes i.black i.female age i.female#c.age, nolog > margins female#black, at(age = (20(10)70)) post > matrix b = r(b) > matrix at = r(at) > mata > b =st_matrix("b") > b = rowshape(b,6) > st_matrix("b", b) > end > clear > svmat at > svmat b > line b* at5 > > It would be nice to extract the information in the r(b) matrix to > relabel the legend, but I am not sure how. > > Scott > > > On Mon, Sep 20, 2010 at 10:32 AM, Richard Williams > <richardwilliams.ndu@gmail.com> wrote: >> 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: 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/ >> > > * > * 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/ ------------------------------------------------------- "'kill -9' is a sure kill" - UNIX man pages * * 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/

**References**:**st: Graphic displays or results from margins***From:*Richard Williams <richardwilliams.ndu@gmail.com>

**Re: st: Graphic displays or results from margins***From:*Scott Merryman <scott.merryman@gmail.com>

- Prev by Date:
**st: SVAR approach by Blanchard and Perotti** - Next by Date:
**Re: st: -cluster measures- with Gower measure** - Previous by thread:
**Re: st: Graphic displays or results from margins** - Next by thread:
**Re: st: Graphic displays or results from margins** - Index(es):