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

Re: st: RE: Spearman correlations in Stata 8


From   "Vasilis.Sarafidis" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Spearman correlations in Stata 8
Date   09 Nov 2005 22:10:17 +0000

That is very helpful indeed. Thank you so much!

Vasilis

On Nov 9 2005, Nick Cox wrote:

There are many ways to do this in Stata 8.
One is to generate ranks for all your variables, and then run -correlate- on the ranks.
foreach v of var frog toad newt gingrich { egen rank_`v' = rank(`v') }
corr rank_*
That, however, requires some care if there
are missings in some or all of the variables. Safer is this:
egen nmiss = rmiss(frog toad newt gingrich) foreach v of var frog toad newt gingrich { egen rank_`v' = rank(`v') if nmiss == 0 }
corr rank_*
Another is to create a matrix full of missings, and then populate it with individual correlations. There are
various canned ways of doing that. One is to use -makematrix- from
SSC. Another is to use -cpspear-
from SSC.
Another method is to use -pwcorrs- from the STB.
Note that typing
. findit spearman
in Stata would have pointed you to -cpspear-
and -pwcorrs-. This is part of the standard
advice for finding stuff in the Statalist FAQ.
Nick [email protected]
Vasilis.Sarafidis


I need to calculate Spearman correlation coefficients for a large number of variables and get them in a single matrix . In Stata 9 this is implemented easily, typing the command spearman varlist. In Stata 8 the command spearman handles two variables only, if I am not wrong. Is there any way to do this in Stata 8?
*
*   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/

--
If I could get my membership fee back, I'd resign from the human race.
Fred Allen (1894 - 1956)



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