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

Re: st: making sure on the graph

From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: making sure on the graph
Date   Fri, 04 Sep 2009 09:20:21 +0200

Am Donnerstag, den 03.09.2009, 22:35 -0400 schrieb Nirina F:
> Hello,
> I have the following variables : wage and year of birth
> I would like to graph the mean(wage) on y axis and year of birth on x axis.
> Should I sort the wage by year of birth to calculate the mean of wage and then
> scatter meanofwage yearofbirth

. 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

Many regards


*   For searches and help try:

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