Bookmark and Share

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

[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 <>
To   "''" <>
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. 



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:
* 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:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index