Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Drawing a sample that maintains means


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Drawing a sample that maintains means
Date   Fri, 11 Oct 2002 17:51:06 +0100

Sayer, Bryan
> 
> I want to plot weight by age for two groups on the same 
> graph.  One of the
> groups has about 18,000 observations, which really crowds 
> the graph.  The
> other has about 700 observations.  So I would like to draw 
> a sample that
> will plot well, but maintain the mean weight (to one 
> decimal place) at each
> of six exams for each of the two groups.  Is there a good 
> way to draw a
> sample this specific?
> 

One decimal place? I guess you are using not 
standard scientific units, but U.S. units, and that 
these data are for people, so weights are in pounds. 
If ages are in years, then perhaps this reduces to 
something like

. egen tag = tag(group age weight) 
. separate weight, by(group) 
. gra weight? age if tag, sy(op) 

That is, only one observation from 
each subset with the same values of age, group 
and year is tagged, and therefore graphed. 

If your observations are less granular 
nearest pound and age last birthday, 
then this may not help. 

Nick 
[email protected] 

*
*   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