Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cor_diff

Test the difference between two correlations.


Description

Test the difference between two correlations.

Usage

cor_diff(r1, n1, r2, n2, n = NULL, rcov = NULL)

Arguments

r1, r2

Correlation coefficients (Pearson's r).

n, n1, n2

Sample sizes.

rcov

[optional] Only for nonindependent rs:

r1 is r(X,Y),

r2 is r(X,Z),

then, as Y and Z are also correlated,

we should also consider rcov: r(Y,Z)

Value

Invisibly return the p value.

Examples

# two independent rs (X~Y vs. Z~W)
cor_diff(r1=0.20, n1=100, r2=0.45, n2=100)

# two nonindependent rs (X~Y vs. X~Z, with Y and Z also correlated [rcov])
cor_diff(r1=0.20, r2=0.45, n=100, rcov=0.80)

bruceR

Broadly Useful Convenient and Efficient R Functions

v0.6.2
GPL-3
Authors
Han-Wu-Shuang Bao [aut, cre]
Initial release
2021-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.