At 5:02 PM +0000 11/29/10, Adaikalavan Ramasamy wrote:
Thanks for providing the example but it would be useful to know who
I am communicating with or from which institute, but nevermind ...
I don't know much about this subject but a quick google search gives
me the following site: http://davidmlane.com/hyperstat/A50760.html
Using the info from that website, I can code up the following to
give the two-tailed p-value of difference in correlations:
diff.corr <- function( r1, n1, r2, n2 ){
Z1 <- 0.5 * log( (1+r1)/(1-r1) )
Z2 <- 0.5 * log( (1+r2)/(1-r2) )
diff <- Z1 - Z2
SEdiff <- sqrt( 1/(n1 - 3) + 1/(n2 - 3) )
diff.Z <- diff/SEdiff
p <- 2*pnorm( abs(diff.Z), lower=F)
cat( "Two-tailed p-value", p , "\n" )
}
diff.corr( r1=0.5, n1=100, r2=0.40, n2=80 )
## Two-tailed p-value 0.4103526
diff.corr( r1=0.1, n1=100, r2=-0.1, n2=80 )
## Two-tailed p-value 0.1885966
The p-value here is slightly different from the Vassar website
because the website rounds it's "diff.Z" values to 2 digits.
Regards, Adai
See also r.test in the psych package which will test for the
difference between two independent correlations as well as the more
complicated case of two dependent correlations.
r.test(n=100,r12=.5,r34=.4, n2=80)
Correlation tests
Call:r.test(n = 100, r12 = 0.5, r34 = 0.4, n2 = 80)
Test of difference between two independent correlations
z value 0.82 with probability 0.41
r.test(n=100, .1,-.1,n2=80)
r.test(n=100, .1,-.1,n2=80)
Correlation tests
Call:r.test(n = 100, r12 = 0.1, r34 = -0.1, n2 = 80)
Test of difference between two independent correlations
z value 1.31 with probability 0.19
Bill
On 29/11/2010 15:30, syrvn wrote:
Hi,
based on the sample size I want to calculate whether to correlation
coefficients are significantly different or not. I know that as a first step
both coefficients
have to be converted to z values using fisher's z transformation. I have
done this already but I dont know how to further proceed from there.
unlike for correlation coefficients I know that the difference for z values
is mathematically defined but I do not know how to incorporate the sample
size.
I found a couple of websites that provide that service but since I have huge
data sets I need to automate this procedure.
(http://faculty.vassar.edu/lowry/rdiff.html)
Can anyone help?
Cheers,
syrvn
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.