correlation {MetNet} | R Documentation

## Create an adjacency matrix based on correlation

### Description

`correlation` infers an adjacency matrix using correlation using the `corAndPvalue` function (from the `WGCNA` package), `pcor` (from `ppcor`) or `spcor` (from `ppcor`). `correlation` extracts the reported p-values from the function `corAndPvalue`, `pcor` or `spcor` that can be adjusted for multiple testing (`correlation_adjust` parameter) and will return an unweighted adjacency matrix containing edges if the (adjusted) p-value is below the value defined by `correlation_threshold`.

### Usage

    correlation(x, correlation_adjust="none", type="pearson",
                                            correlation_threshold=0.05, ...)

### Arguments

`x` | matrix, where columns are the samples and the rows are features (metabolites), cell entries are intensity values
`correlation_adjust` | character
`type` | character, either "pearson", "spearman", "pearson_partial", "spearman_partial", "pearson_semipartial" or "spearman_semipartial". `type` will be passed to argument `method` in `corAndPvalue` (in the case of "pearson" or "spearman") or to `method` in `pcor` ("pearson" and "spearman" for "pearson_partial" and "spearman_partial", respectively) or to `method` in `spcor` ("pearson" or "spearman" for "pearson_semipartial" and "spearman_semipartial", respectively)
`correlation_threshold` | numeric, significance level α (default: 0.05), if the (adjusted) p-values exceed this value, there is no statistical connection between features
`...` | parameters passed to `corAndPvalue` (argument `adjust` will be ignored)

### Details

If "pearson" or "spearman" is used as a `method` the function `corAndPvalue` from `WGCNA` will be employed. If "pearson_partial" or "spearman_partial" is used as a `method` the function `pcor` from `spcor` will be employed. If "pearson_semipartial" or "spearman_semipartial" is used as a `method` the function `spcor` from `spcor` will be employed. For use of the parameters used in the `corAndPvalue` function, refer to ?WGCNA::corAndPvalue.

### Value

matrix, matrix with edges inferred from correlation algorithm `corAndPvalue`, `pcor` or `spcor` (depending on the chosen method)

### Author(s)

Thomas Naake, thomasnaake@googlemail.com

### Examples

    data("x_test", package="MetNet")
    x <- x_test[, 3:dim(x_test)[2]]
    x <- as.matrix(x)
    correlation(x, correlation_adjust="bonferroni", type="pearson")

[Package MetNet version 1.2.0 Index]