corr.matrix: Calculate correlation matrix and threshold

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/corr_matrix.R

Description

corr.matrix calculates the correlation between all column pairs of a given data frame, and thresholds the resultant correlation matrix based on a given density (e.g., 0.1 if you want to keep only the 10% strongest correlations). If you want to threshold by a specific correlation coefficient (via the thresholds argument), then the densities argument is ignored.

Usage

1
corr.matrix(resids, densities, thresholds = NULL, exclusions = NULL, ...)

Arguments

resids

Data table of the residuals (from get.resid)

densities

Numeric vector indicating the resultant network density(ies); keeps the top X% of correlations

thresholds

Numeric; absolute correlation value to threshold by (default: NULL)

exclusions

Numeric vector of indices (columns) to exclude (default: NULL)

...

Other arguments, passed to rcorr

Details

If you wish to exclude regions from your analysis, you can give the indices of their columns with the exclusions argument.

By default, the Pearson correlation coefficients are calculated, but you can return Spearman by passing an additional argument.

Value

A list with the following components:

R

Numeric matrix of correlation coefficients.

P

Numeric matrix of p-values.

r.thresh

A 3-d binary array indicating correlations that are above a certain threshold. The length of the 3rd dimension equals the number of thresholds/densities supplied.

thresholds

Numeric vector; the thresholds supplied.

densities

Numeric vector; the densities supplied.

Author(s)

Christopher G. Watson, [email protected]

See Also

rcorr

Other Structural covariance network functions: IndividualContributions, brainGraph_boot, brainGraph_init, brainGraph_permute, get.resid, plot.brainGraph_resids, plot_volumetric

Examples

1
2
3
4
5
## Not run: 
corrs <- lapply(groups, function(x) lapply(densities, function(y)
  corr.matrix(resids.all[x], densities=y)))

## End(Not run)

brainGraph documentation built on Feb. 24, 2018, 1:01 a.m.