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

Re: st: test of two spearman correlations?


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: test of two spearman correlations?
Date   Tue, 17 Feb 2004 12:32:57 +0900

You might be able to use -bootstrap- (or -jknife-) to obtain confidence 
intervals of the correlation coefficients (or of their difference), and there 
are probably other more direct methods, too, but would something like the 
following be worth considering?  

If the assumption made below about the distribution of Spearman's correlation 
coefficients isn't tenable, then perhaps something like the following in a 
program called by -permute- would overcome that.

Joseph Coveney

--------------------------------------------------------------------------------

// creating fictional dataset for illustration
clear
set more off
set obs 100
generate byte bla = _n > _N / 2
set seed 20040217
generate byte age = round(uniform() * 100)
generate float vir = uniform()^2
// Begin here.
spearman age vir if bla
spearman age vir if !bla
// First, rank each of the variables . . .
egen ragb = rank(age) if bla
egen rvib = rank(vir) if bla
egen ragw = rank(age) if !bla
egen rviw = rank(vir) if !bla
// Next, perform OLS least squares regression on the 
// ranks separately (the slope coefficients are the
// Spearman's correlation coefficients) . . .
regress rvib ragb, score(scob)
estimates store B
regress rviw ragw, score(scow)
estimates store W
// Finally, peform Chow's test:
suest B W
test [B_mean]ragb = [W_mean]ragw
exit
// There are also three FAQs about
// Chow's test on Stata Corp's
// website

--------------------------------------------------------------------------------

Joseph Wagner wrote: 

>I have calculated a spearman correlations between two continuous variables
>(age and viral load) for whites and for blacks.  Is there a way to test the
>difference between the spearman rho for whites and blacks?



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