Statalist


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

Re: st: making sure on the graph


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   stata list <statalist@hsphsun2.harvard.edu>
Subject   Re: st: making sure on the graph
Date   Fri, 4 Sep 2009 07:28:44 +0000 (GMT)

--- Ulrich Kohler wrote:
> . egen meanwage = mean(wage), by(yearofbirth)
> . scatter meanwage yearofbirth
>
> is one possibility. The advantage of this solution is that it keeps your
> data as it is. The disadvantage is that the file size of the graph
> becomes arbitrary large if you have many observations. 
>
> A solution that destroys the data in memory but produces smaller graphs
> (in terms of bandwidth) is
> 
> . collapse (mean) wage, by(yearofbirth)
> . scatter wage yearofbirth

An intermediate solution that will get the small graph while keeping the
data intact is:

. bys yearofbirth (wage): gen byte first = _n == 1
. egen meanwage = mean(wage), by(yearofbirth)
. scatter meanwage yearofbirth if first

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

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



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