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

Description Usage Arguments Value Author(s) 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 https://stackoverflow.com/a/14519007/3357706.

Usage

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

Arguments

r1, r2

Numeric (vector or matrix) of correlation coefficients for both groups

n

Integer vector; number of observations for both groups

alternative

Character string, whether to do a two- or one-sided test. Default: 'two.sided'

Value

A list with elements p and z, the p-values and z-scores for the difference in correlations.

Author(s)

Christopher G. Watson, cgwatson@bu.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
kNumSubjs <- summary(covars$Group)
corr.diffs <- cor.diff.test(corrs$R[, , 1], corrs$R[, , 2], kNumSubjs)
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 Oct. 23, 2020, 6:37 p.m.