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]
Re: st: Routine from do-file that every time it's run gives a different result
From
Clarice Martins <[email protected]>
To
[email protected]
Subject
Re: st: Routine from do-file that every time it's run gives a different result
Date
Fri, 8 Nov 2013 19:42:06 -0200
Thanks to all Nick, Sarah, Roberto e Segiy!!
Not only I stabilized the results, as I learned a lot about -sort- , -quantiles- , etc.
The problem was really at the use of random excess of -sort- commands before important steps were made. I reviewed every line using some of the tools the group have provided:
- 1st - used the -sum- after every new variable was created or changed;
- 2nd (in parallel actually) - used -isid- after every -sort- to understand if that -sort- was producing meaningful data. Then changed every -sort- command that caused an error message.
With these, it was easy to see that I was using some -sort- orders that caused data that were not uniquely identified. (I still need to look into the Quantiles methodology in depth.)
Thanks very much for your great advice!!
Clarice
On Nov 7, 2013, at 4:16 PM, Nick Cox wrote:
> No. -xtile- sorts the data for you if they are not sorted, but
> whatever it changes is done only temporarily.
>
> As Sergiy implies, subdivision by quantiles (e.g. quintiles) is
> reproducible if you use the same rules for calculating quantiles.
>
> See also e.g. Hyndman and Fan on quantile calculation. There is a copy
> (licit or not) at
>
> https://www.amherst.edu/media/view/129116/original/Sample+Quantiles.pdf
>
> Nick
> [email protected]
>
>
> On 7 November 2013 18:05, Clarice Martins <[email protected]> wrote:
>
>> After Nick's comment: (Thanks, Nick also!)
>>>> And -xtile- is written -sortpreserve-
>>>> so it doesn't change the sort order of your data.
>>
>>
>> Do this means that I need to be aware of how data is sorted before using -xtile- ?
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/