| paired.r {psych} | R Documentation |
Test the difference between paired correlations. Given 3 variables, x, y, z, is the correlation between xy different than that between xz? If y and z are independent, this is a simple t-test. But, if they are dependent, it is a bit more complicated.
paired.r(xy, xz, yz, n)
xy |
r(xy) |
xz |
r(xz) |
yz |
r(yz) |
n |
Number of subjects |
Find a t2 statistic for the difference of two dependent correlations.
t2
William Revelle
Northwestern University
Evanston, Illinois
revelle@northwestern.edu
http://personality-project.org/revelle.html
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function(xy,xz,yz,n) {
diff <- xy-xz
determin=1-xy*xy - xz*xz - yz*yz + 2*xy*xz*yz
av=(xy+xz)/2
cube= (1-yz)*(1-yz)*(1-yz)
t2 = diff * sqrt((n-1)*(1+yz)/(((2*(n-1)/(n-3))*determin+av*av*cube)))
return(t2)
}