Bookmark and Share

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


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

st: trajectory graph can not come out with connecting line


From   Q X <[email protected]>
To   <[email protected]>
Subject   st: trajectory graph can not come out with connecting line
Date   Wed, 1 Dec 2010 09:50:57 -0500

Hi there,
 
I follow the method of file I attached below. But on last command, “twoway () () (line x y)” there is no line connecting the dots on my graph. I can not figure out why it happens. My dataset is strongly balanced panel data with years 1960,1970,1980,1990,2000.I want to tract the pattern of population over these five year. So, the population growth rate are all distributed on 1970,1980,1990,2000. 
 
Thanks.
Cecilia
 
 
 
Command on website:
*trajectory2.do file for Stata 10.0
use cd4.dta, clear
egen newid=group(id)
sum newid
drop id
rename newid id
gen timedays=round(time*365.25,1)
sort id timedays
egen cd4mean = mean(count), by(id)
list id count cd4mean in 1/10
sort id
quietly by id: replace cd4mean=. if (_n > 1) 
egen rnk=rank(cd4mean) 
local i = 1 
while `i' <= 7{
     gen sub`i' =(rnk == `i'*25)
     sort id timedays
     quietly by id: replace sub`i'=sub`i'[1]
     gen cd4l`i' = count if (sub`i')
     drop sub`i'
     local i=`i'+1
}
ksm count timedays, lowess gen(cd4smth) nograph twoway (scatter count timedays) (scatter cd4smth timedays) (line
cd4l1-cd4l7 timedays) 		 	   		  
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index