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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

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

Subject |
st: RE: St: Re: graph over |

Date |
Thu, 2 Apr 2009 12:41:32 +0100 |

The technique Allan mentions here can certainly be useful. But using the official command -separate- directly is much less work than the route outlined here. This was added in Stata 6, and so is certainly available to Allan as a Stata 9.2 user. The code would be something like . separate ESL, by(school) veryshortlabel . line `r(varlist)' time Conversely, the main motivation for the -separate- command was to provide a direct tool for precisely this problem. However, for Caleb's original problem -xtline- is even more direct, as already posted. Nick n.j.cox@durham.ac.uk Allan Reese There's a generic answer to this that I prefer to call lateral thinking rather than a kludge. The data comprises three variables: ESL percentage - the Y var time of observation - the X var school (categorical) - the group var Scatterplot Y against X shows the overall pattern, and Stata has an option to label each point with its group. However, it's not immediately obvious how to plot the groups with different symbols: msymbol(varname) is not available [HINT to StataCorp - it would be nice.] Nor how to join the points for each group. The solution is to restructure the data, and one option would be reshape long->wide, making ESL+school variables. This might be more appropriate if the time points of observations in each school were equivalent, and cross-correlations would be calculated. My usual solution is to keep the original cases but divide the observations for each group into separate variables. You can do this by a series of gen ESL1 = ESL if school==1 // etc or xi , noomit i.school|ESL recode _I* (0=.) except that (in my Stata 9.2) generates the dummy main effect variables as well, contrary to Manual [HINT to StataCorp - bug? Known?] Then scatter _IschoolX* time plots each school with a different symbol (within system limits for no of groups!). Any other twoway plot with a varlist would be similar. There are lots of graph problems that are best tackled by splitting one variable into groups. * * 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: St: Re: graph over***From:*"Allan Reese (Cefas)" <allan.reese@cefas.co.uk>

- Prev by Date:
**Re: st: IV estimation for probit models with binary endogenous variable...?** - Next by Date:
**Re: st: IV estimation for probit models with binary endogenous variable...?** - Previous by thread:
**st: St: Re: graph over** - Next by thread:
**st: IV estimation for probit models with binary endogenous variable...?** - Index(es):

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