Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Changing -correlate- results


From   "louis boakye-yiadom" <louisby@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: RE: Changing -correlate- results
Date   Mon, 21 Mar 2005 13:11:06 +0000

I've tried both the -egen- and -sort, stable- approaches; each gives me identical results after each execution of the do file. With -egen- the correlation coefficient is always 0.7498, and with -sort, stable-, the result is always 0.7608. I suppose the difference in the two results lies in how tied ranks are treated. Thank you all very much.

Louis





From: "Scott Merryman" <smerryman@kc.rr.com>

Tied values are randomized. From the helpfile:

"Note: ties in the sort index (i.e., identical sorting values) are broken in
an arbitrary (i.e., random) order, unless the stable option is specified."

You might try:

sort f1, stable

sort f2, stable

Hope this helps,
Scott

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index