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


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

st: RE: trajectory graph can not come out with connecting line


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: trajectory graph can not come out with connecting line
Date   Wed, 1 Dec 2010 15:01:56 +0000

If I understand you correctly, you're asking (again) about a problem you got with code you don't show us. 

You would be better off showing us your code, rather than just repeating the question. 

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

Cecilia

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. 
 
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index