Bookmark and Share

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, is already up and running.

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

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

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: RE: RE: Simple panel data mean plot
Date   Thu, 24 Jun 2010 13:12:02 +0100

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


Martin Weiss

Of course you can:

use, clear
graph bar (mean) age, over(year)

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


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

Nick Cox

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


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:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index