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

From |
Nick Winter <nwinter@virginia.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Create graph directly from matrix? |

Date |
Mon, 16 Nov 2009 12:59:10 -0500 |

Nick Cox wrote:

I agree. This is clever. But there is no new principle here. _n in anyexpression yielding a new variable is interpreted observation byobservation.Nickn.j.cox@durham.ac.ukNick Winter Ah, interesting.Looking within -_matplot-, it looks like the fundamental answer to myquestion might be "no", since that program creates temporary variablesthat it then plots.But it uses an interesting construction that may help me go thevariables route without using -svmat-:gen x = Xy[_n,1] in 1/16creates a new variable -x- from the first column of matrix Xy. Prettyspiffy to use _n to tag the observation number/row number.- Nick Nick Cox wrote:Check out the undocumented command -_matplot-.Nickn.j.cox@durham.ac.ukNick Winter I'm wondering if there is a way to convert the values held into amatrixinto a graph (ie, into a serset that serves as the basis for a graph)directly, without first making the matrix into variables?Why I'm curious: I'm thinking about revising my -oprobpr- command, which plotspredictedprobabilities after order l/probit models. The new -margins- commandcan fairly easily calculate what's required for the plotting, andthoseresults can be saved as a matrix, using -margins-'s -post- option. So I'd like to plot the estimates returned in e(b) against values in e(at). I can put this stuff all together in one matrix, eg: sysuse auto probit foreign mpg price weight margins, atmeans at(mpg=(12(2.9)41)) post mat b = e(b) mat X = e(at) mat Xy = X , b' Then I'd like to create, eg, a line plot of the final column (namedy1)against the first column (mpg).I can, of course, use -svmat-, graph the relevant variables, and dropthe variables.But I'd love a more elegant solution.* * 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/

-- -------------------------------------------------------------- Nicholas Winter 434.924.6994 t Assistant Professor 434.924.3359 f Department of Politics nwinter@virginia.edu e University of Virginia faculty.virginia.edu/nwinter w PO Box 400787, 100 Cabell Hall Charlottesville, VA 22904 * * 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: Create graph directly from matrix?***From:*Nick Winter <nwinter@virginia.edu>

**st: RE: Create graph directly from matrix?***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: Create graph directly from matrix?***From:*Nick Winter <nwinter@virginia.edu>

**RE: st: RE: Create graph directly from matrix?***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: baseline adjustment in mixed models** - Next by Date:
**Re: st: How do I suppress output in mata?** - Previous by thread:
**RE: st: RE: Create graph directly from matrix?** - Next by thread:
**Re: st: Create graph directly from matrix?** - Index(es):

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