Statalist


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

Re: st: Inappropriate lines joining up between individuals in twoway line graph


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Inappropriate lines joining up between individuals in twoway line graph
Date   Tue, 27 Oct 2009 10:00:34 -0400

Ada Lo <[email protected]> :
Do you really want 490 separate line graphs overlaid?  Perhaps these
examples will be instructive:

clear all
input id m age
1 2 3
1 3 11
2 4 4
2 3 6
3 2 7
3 4 10
4 5 11
end
line m age, c(L) name(line)
egen c=count(m), by(id)
tsset id age
xtline m, ov addplot(sc m age if c==1) leg(off)

clear all
range id 1 490 490
expand 3
bys id:g age=5+_n*4
g m=rnormal(age,age) if uniform()>.3
egen c=count(m), by(id)
line m age, c(L) name(line)
tsset id age
xtline m, ov addplot(sc m age if c==1) leg(off)

On Mon, Oct 26, 2009 at 10:05 PM, Ada Lo <[email protected]> wrote:
> Hi all,
>
> This is the first time I'm posting on stata list so please forgive me
> if I'm not doing it right.
>
> I have a question about the graph produced by this command - twoway
> line Memory age, connect(ascending)
> The data are in balanced long format, 3 repeated measurements over 8
> years for roughly 490 participants with missing data.
> I sorted the data by StudyID and age before running the twoway command.
> The graph produced should represent the trajectory of memory changes
> for each individual. However, I noticed that STATA sometimes joined up
> the measurement between individuals when they had missing data.
>
> Does that make sense to people? Is there a way to fix this up so that
> I would see a line or a single dot (if only 1 measurement was
> available) for each individual?
>
> Your help would be much appreciated.
>
> Ada
*
*   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/



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