Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Thanks re: Arbitrary limits on number of data series for line plots


From   "Allan Reese (Cefas)" <[email protected]>
To   "'Statalist (E-mail)" <[email protected]>
Subject   st: Thanks re: Arbitrary limits on number of data series for line plots
Date   Fri, 28 Apr 2006 14:51:47 +0100

Thanks to Nick Cox for drawing my attention to "help stylelists".  That will save a lot of typing in future.

Michael Blasnik is right that plotting these graphs from the long format data is a better solution.  I've tried that in the past, and failed because data were not sorted correctly or there might be single points.  In these data each individual was necessarily observed over a series of days, so the data can be reverse-sorted by the start-date for each individual, then forward-sorted on the individual's dates.  c(L) then works fine.

Long data has vars id, day, y

egen minday= min(day), by(id)
gsort  -minday day
scatter y day, c(L) ms(i)

Wow, that's saved some typing!  Thanks.

I'd got in the habit of structuring data wide (multiple variables) so that different variables (subsets) could be distinguished. It's also easier to stick with scatter, rather than use other specialist commands and look up which options are allowed with each.  There are other ways of doing the following:

gen malewt = weight if sex=="M"
gen femwt = weight if sex=="F"
gen vbig = weight>100
scatter malewt femwt vbig day, c(l l .) ms(i i t) mlab(. . id)

Thanks to Vince Wiggins for technical background.  In the immediate application, finding the limit of 100 lines just helped me decide the data fell naturally into subsets, with fewer than 100 individuals in each. So no problem in waiting for future updates ;-)  As Vince points out, if there's a limit, some fool will try to bend it.

Allan


***********************************************************************************
This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
***********************************************************************************


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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