Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: RE: RE: RE: RE: Simple panel data mean plot

 From "Martin Weiss" To Subject st: RE: RE: RE: RE: RE: Simple panel data mean plot Date Thu, 24 Jun 2010 15:41:35 +0200

```<>

" That would not be a line plot, which was requested."

I acknowledged this in
http://www.stata.com/statalist/archive/2010-06/msg01341.html, our posts must
have crossed.

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Donnerstag, 24. Juni 2010 14:12
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: RE: RE: RE: Simple panel data mean plot

That would not be a line plot, which was requested.

Here's another way with the same dataset:

egen mean = mean(age), by(year)
egen tag = tag(year)
twoway line mean year if tag, sort
twoway connected mean year if tag, sort

Nick
n.j.cox@durham.ac.uk

Martin Weiss

Of course you can:

*************
use http://www.stata-press.com/data/r11/nlswork.dta, clear
graph bar (mean) age, over(year)
*************

You can also -preserve-/-restore- your way around the destruction of
your
data...

Yann DE MEY

Thank you for this working solution. However, a method that does not
clear/replace my current dataset would be more practical. I really feel
like
this is a simple 'problem' and hope there is another easy command?

Nick Cox

-collapse- first; then it's -twoway line-.

Yann DE MEY

I have a very simple problem: I have a panel dataset and would like to
easily get an overview graph that plots the mean of all observations as
a function of year and connects them with a line. Basically I want to
plot the results from:

table year, contents (mean VARIABLE)

The 'mband' command is the closest I found, but this command uses the
median and not the mean.

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