cor.diff.test: Calculate the p-value for differences in correlation...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utils.R

Description

Given two sets of correlation coefficients and sample sizes, this function calculates and returns the z-scores and p-values associated with the difference between correlation coefficients. This function was adapted from http://stackoverflow.com/a/14519007/3357706.

Usage

1
cor.diff.test(r1, r2, n1, n2, alternative = c("two.sided", "less", "greater"))

Arguments

r1

Numeric (vector or matrix) of correlation coefficients, group 1

r2

Numeric (vector or matrix) of correlation coefficients, group 2

n1

Integer; number of observations, group 1

n2

Integer; number of observations, group 2

alternative

Character string specifying the alternative hypothesis test to use; one of: 'two.sided' (default), 'less', 'greater'

Value

A list containing:

p

The p-values

z

The z-score for the difference in correlation coefficients

Author(s)

Christopher G. Watson, [email protected]

See Also

Other Matrix functions: apply_thresholds, create_mats, symmetrize_mats

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
kNumSubjs <- summary(covars$Group)
corr.diffs <- cor.diff.test(corrs[[1]][[1]]$R, corrs[[2]][[1]]$R,
                            kNumSubjs[1], kNumSubjs[2], alternative='two.sided')
edge.diffs <- t(sapply(which(corr.diffs$p < .05), function(x)
                       mapply('[[',
                              dimnames(corr.diffs$p),
                              arrayInd(x, dim(corr.diffs$p)))
                              ))

## End(Not run)

brainGraph documentation built on May 29, 2018, 9:03 a.m.