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.

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

From |
Mandy fu <mandy.fu1@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st:graphing the lines of the mean for a varaible by groups over time |

Date |
Fri, 12 Mar 2010 13:06:22 -0500 |

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/

**Follow-Ups**:**st: RE: graphing the lines of the mean for a varaible by groups over time***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: RE: graphing the lines of the mean for a varaible by groups over time***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**RE: st: hausman test xtivreg(re) vs ivreg** - Next by Date:
**st: RE: graphing the lines of the mean for a varaible by groups over time** - Previous by thread:
**st: time trend or year effect for pooled data** - Next by thread:
**st: RE: graphing the lines of the mean for a varaible by groups over time** - Index(es):