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

# RE: st: RE: trajectory graph can not come out line with my code

 From Nick Cox To "'statalist@hsphsun2.harvard.edu'" Subject RE: st: RE: trajectory graph can not come out line with my code Date Thu, 2 Dec 2010 17:33:09 +0000

```Cecilia Ann:

I think you are seriously misreading both this and the posting by Austin Nichols.

You accuse us of "verbal attacks", and much else besides, but we replied to your questions making specific positive suggestions and identifying specific problems with your apparent understanding of Stata and with your formulation of questions. The fact is that "doesn't work" means almost nothing even to Stata experts.

Sorry it hasn't worked out in terms of your understanding of your problems, but we tried. I think you just reduced the number of people on this list who will want to answer your questions if this is how you respond to people who are giving up their time on your behalf.

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

Cecilia Ann

Nick's comment is meant to be verbal attack !

I copy the code simply because I am learning the logic. This procedure hurts nothing! It has nothing to do with peril!
I think you are confused about the difference of plagiarism and learning!

My suggestion to you is trying all your best to learn the basics!

----------------------------------------
> From: n.j.cox@durham.ac.uk

> I don't understand either why you need to calculate ranks. I imagine you don't. That is just what someone else did for their purposes. This shows the perils of copying code that you don't completely understand, although in some sense almost everybody does precisely that some of the time.
>
> My eye is drawn to the condition
>
> (rankpopgrowth==`i'*.1)
>
> Within a loop i = 1/7 you are testing whether rankpopgrowth is, so far as Stata is concerned, exactly equal to 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7.
>
> Very likely there are no such values.
>
> Also, this kind of computation seems to be assuming that Stata is being run on a computer that deep down works with decimal, but that is not the case. Computers work with binary.
>
>
> . search precision
>
> in Stata.
>
> In any case, look at the data you think you are plotting using e.g. -list- or -edit-. My guess is that you have lots of missing values.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Cecilia
>
> 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.
>
> My code is as follows.
> replace popgrowth=. if popgrowth>23
> egen newid=group(geo_id2)
> sum newid
> drop geo_id2
> rename newid id
> order id year
> sort id popgrowth
> egen popgrowthmean=mean(popgrowth),by(id)
> list id popgrowth popgrowthmean in 1/10
> sort id
> quietly by id:replace popgrowthmean=. if (_n>1)
> egen rankpopgrowth=rank(popgrowthmean)
> local i=1
> while `i'<=7{
> gen sub`i'=(rankpopgrowth==`i'*.1)
> sort id year
> quietly by id:replace sub`i'=sub`i'[1]
> gen pop1`i'=popgrowth if (sub`i')
> drop sub`i'
> local i=`i'+1
> }
> ksm popgrowth year,lowess gen(popgrowthsmth)
> twoway (scatter popgrowth year) (scatter popgrowthsmth year) (line pop11-pop17 year)
>
>
> I think the number of pattern of population growth may be seven. So, I set `i'<=7. But, I do not understand why wee need to generate rank of populationgrowthmean.

*
*   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/
```