Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: Help making graph: connecting pre- and post- for 22 individuals

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: Help making graph: connecting pre- and post- for 22 individuals
Date   Sun, 6 Jun 2004 17:36:50 +0100

Your approach is clearly correct in principle, 
but you not surprisingly drew the line at giving 
the complete specification of the 22 graphs 
superimposed on top of each other needed to 
apply your approach to Erik's example dataset. 

Fortunately, it can always be done more 
easily. With two (non-missing) scores for every student, 

sort student time 
twoway connected score time, c(L) 

is easier to type and the result is much 

With a more general structure (panel data, 
whether or not named as such), and the 
possibility of missing values, or different 
times of observation, a simple 
-connect(L)- may give rise to spurious connections 
between successive panel members, depending on the 
precise configuration of data, as has long been 

This can always be avoided, either by declaring 
the data to be panel and using -tsline-, or 
(as indicated by my earlier mailing in this 
thread) by using -linkplot- from SSC. 

Although when faced with data on this form 
many analysts would think their way 
to a graph with time on the horizontal 
axis and the changing response on 
the vertical axis, for just two times 
this usually implies a criss-crossing 
pattern of lines which is not always 
easy to interpret. 

Erik and I had an interesting discussion 
off-line about alternatives, centred on 
the use of -pairplot- from SSC, following 
my earlier posting. 

As for cell means in ANOVA, I do not 
know what you want to do, but several official 
and user-written programs provide post-modelling
graphics after -anova-. 


P.S. -xlabel(1 2)- 

Bryan W. Griffin
> I'm interested in something like this too for plotting cell 
> means after 
> ANOVA. Here is one way to accomplish the task:
> Reorganize data such as this (to keep this simple I used data 
> from only the 
> first 3 of your 22 students):
> student score   time
> 1       4.5     1
> 1       5.25    2
> 2       3.5     1
> 2       5.25    2
> 3       7.5     1
> 3       7.5     2
> Student 1 has scores of 4.5 and 5.25 on occasion 1 and 2, 
> student 2 has 3.5 
> and 5.25 on time 1 and 2, etc.
> . twoway  (connected score time if student==1)  (connected 
> score time if 
> student==2)  (connected score time if student==3)
> This command will give you the graph desired. The only 
> problem I have is 
> with the x-axis. I want only time 1 and 2 showing on the 
> axis, but the 
> graph provides points between 1 and 2, such as 1.2, 1.4, 1.6, 
> and 1.8 and I 
> could not figure how to suppress those numbers. For those 
> knowledgeable 
> with graphing, how does one suppress these numbers between 1 and 2?

*   For searches and help try:

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