compute_cor: Compute the (partial) correlation between columns of the...

Description Usage Arguments Details Value

View source: R/compute_cor.R

Description

If the matrix 'control' is defined, the partial correlation is computed with-respect-to this matrix.

Usage

1
compute_cor(x, source_id, target_id, control = NULL)

Arguments

x

A matrix. We want to perform correlation between pairs of columns of x.

source_id, target_id

Colnames within the matrix 'x'; each pair of (source_id, target_id) values corresponds to a pair of column vectors in 'x' that we want to perform correlation analysis on.

control

A matrix. this provides a numeric control for partial correlation (eg, allowing a different baseline mean for different datasets). See ppcor::pcor for details of how to specify control.

Details

From the outside, this is vectorised over source_id and target_id; each source_id / target_id pair will be used in the correlation analysis.

For each source_id, s: - For each target_id, t, of s: - Compute the (partial) correlation between s and t

[For partial correlation, compute the correlation between the residuals of s and the residuals of t, after regressing-out the 'control' matrix]

Then compute the z-score for each correlation coefficient based on Fisher's transformation (using Fisher's z-score transformation for correlation coefficients)

Value

A tibble (source_id, target_id, partial_cor, z_score)


russHyde/coxpresdbr documentation built on Dec. 24, 2019, 11:59 a.m.