Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: RE: graphing the lines of the mean for a varaible by groups over time

 From "Martin Weiss" To Subject st: RE: graphing the lines of the mean for a varaible by groups over time Date Fri, 12 Mar 2010 19:55:48 +0100

```<>

*************
help grmeanby
*************

may also be of interest...

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Mandy fu
Sent: Freitag, 12. März 2010 19:06
To: statalist@hsphsun2.harvard.edu
Subject: st:graphing the lines of the mean for a varaible by groups over
time

Hello everyone,

I have a question of graphing the lines of a variable  by groups over
time on a three-period panel data set.

I have an  unbalanced 3-period panel data set, where the observations
are divided into four racial groups. I would like to plot the
predicted value of Y (which is variable Y_hat, results from previous
regression of Y on X variables) by racial groups over the three
periods.

The X-axis measures time, 1,2,3;
The Y-axis measures Y-hat.
In the graph there are four lines, repenting the four racial groups,
which measure the mean Y_hat for a particular group at each time.

The data set is as following:
------------------------------------------------------------
ID    Y_hat   time    race        Y    X1      X2
1      1.22     1         1
1      2.03     2         1
1      3.00     3         1
2      1.45     1         2
2      2.67     2         2
2     missing 3         2
------------------------------------------------------------
I tried the following syntax:
------------
line Y_hat time if race==1 ,c(L)  ///
||    line  Y_hat time if race==2 ,c(L)  ///
||    line  Y_hat time if race==3 ,c(L)  ///
||    line Y_hat time if race==1 ,c(L)   ///
|| , title("plotting")
---------------
The graph from the above syntax includes lots of lines, which is not
what I would like to see.

I think I must misunderstood something here. I would appreciate if you
could give me some suggestions.

Thanks for your time!

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

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