correlation: Create an adjacency matrix based on correlation

View source: R/statistical.R

correlationR Documentation

Create an adjacency matrix based on correlation

Description

'correlation' infers an adjacency matrix using correlation using the 'corr.test' function (from the 'psych' package) or partialCorrelation. 'correlation' extracts the reported pair-wise correlation coefficients from the function 'corr.test' and 'partialCorrelation' and will return the weighted adjacency matrix of the correlation coefficients, together with the associated p-values.

Usage

correlation(x, method = "pearson", p.adjust = "none", ...)

Arguments

x

'matrix', where columns are the samples and the rows are features (metabolites), cell entries are intensity values

method

'character', either "pearson", "spearman", "pearson_partial", "spearman_partial", or "ggm".

p.adjust

'character', method of p-value adjustment passed to 'p.adjust'

...

additional arguments passed to 'corr.test' or 'partialCorrelation'

Details

If '"pearson"' or '"spearman"' is used as a 'method', the function 'corr.test' from 'psych' will be employed.

If '"ggm"' is used as a 'method', the function 'ggm.estimate.pcor' from 'GeneNet' will be employed.

If '"pearson_partial"' or '"spearman_partial"' is used as a 'method' the function 'partialCorrelation' will be employed.

'method' will be passed to argument 'method' in 'corr.test' (in the case of '"pearson"' or '"spearman"') or to 'method' in 'partialCorrelation' ('"pearson"' and '"spearman"' for '"pearson_partial"' and '"spearman_partial"', respectively).

Value

'list' containing two matrices, the first matrix contains correlation coefficients and the second matrix contains the corresponding p-values as obtained from the correlation algorithms 'corr.test' or 'partialCorrelation' (depending on the chosen 'method') and optionally the adjusted p.values (argument 'p.adjust')

Author(s)

Thomas Naake, thomasnaake@googlemail.com, Liesa Salzer, liesa.salzer@helmholtz-muenchen.de

Examples

data("x_test", package = "MetNet")
x <- x_test[1:10, 3:ncol(x_test)]
x <- as.matrix(x)
correlation(x, method = "pearson")


tnaake/MetNet documentation built on June 30, 2022, 10:50 a.m.