Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: different result everytime - something strange


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: different result everytime - something strange
Date   Thu, 19 Jun 2008 18:23:36 +0100 (BST)

-glcurve- sorts y. How should Stata decide which row should come first
if two rows have the same value on y? By default it does that 
(pseudo-)randomly, which is reasonalble, but I think this is what is
causing you to get different results each time you call that do-file.
If that is the problem, than it should be solved when you replace the
first line with:

sort y, stable
gen sortorder _n
glcurve y [aw=weight], pvar(rank) replace nograph sortvar(sortorder)

-- Maarten

--- Shehzad Ali <[email protected]> wrote:

> Hi listers,
> 
> I have encountered a funny problem, which maybe due to something
> wrong with 
> my codes or with stata. I am trying to calculate concentration index
> using 
> convenient regression method but everytime I run my do file, I get 
> different results using exactly the same data. I am sure someone can
> help.
> 
> Here is what I am doing:
> 
> glcurve y [aw=weight], pvar(rank) replace nograph      
> qui sum x [fw=weight]	
> scalar mean=r(mean)      
> qui sum rank [fw=weight]   
> sca var_rank=r(Var)     
> gen lhs=2*var_rank*(x/mean)          
> regr lhs rank [pw=weight], cluster(commune)      
> sca CI=_b[rank]        
> display "concentration index", CI
> 
> Any help would be appreciated.
> 
> Shehzad
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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