Learn R Programming

psych (version 2.4.1)

paired.r: Test the difference between (un)paired correlations

Description

Test the difference between two (paired or unpaired) 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 of the z transformed rs. But, if they are dependent, it is a bit more complicated.

Usage

paired.r(xy, xz, yz=NULL, n, n2=NULL,twotailed=TRUE)

Value

a list containing the calculated t or z values and the associated two (or one) tailed probability.

t

t test of the difference between two dependent correlations

p

probability of the t or of the z

z

z test of the difference between two independent correlations

Arguments

xy

r(xy)

xz

r(xz)

yz

r(yz)

n

Number of subjects for first group

n2

Number of subjects in second group (if not equal to n)

twotailed

Calculate two or one tailed probability values

Author

William Revelle

Details

To find the z of the difference between two independent correlations, first convert them to z scores using the Fisher r-z transform and then find the z of the difference between the two correlations. The default assumption is that the group sizes are the same, but the test can be done for different size groups by specifying n2.

If the correlations are not independent (i.e., they are from the same sample) then the correlation with the third variable r(yz) must be specified. Find a t statistic for the difference of thee two dependent correlations.

See Also

r.test for more tests of independent as well as dependent (paired) tests. p.rep.r for the probability of replicating a particular correlation. cor.test from stats for testing a single correlation and corr.test for finding the values and probabilities of multiple correlations. See also set.cor to do multiple correlations from matrix input.

Examples

Run this code
paired.r(.5,.3, .4, 100) #dependent correlations
paired.r(.5,.3,NULL,100) #independent correlations same sample size
paired.r(.5,.3,NULL, 100, 64) # independent correlations, different sample sizes

Run the code above in your browser using DataLab