partialCorrelation | R Documentation |
'partialCorrelation' infers an adjacency matrix of partial correlation values and associated p-values using using the 'cor2pcor' function (from the 'corpcor' package). 'partialCorrelation' calculates the p-values from the number of samples ('n') and the number of controlling variables ('g'). The function will return a list containing the weighted adjacency matrix of the correlation values, together with the associated p-values.
partialCorrelation(x, method = "pearson", ...)
x |
'matrix', where columns are the features (metabolites) and the rows are samples, cell entries are intensity values |
method |
'character', either "pearson", "spearman" |
... |
further arguments passed to 'cor' from 'base' or 'cor2pcor' from 'corpcor' |
The correlation coefficients $r_ij|S$ are obtained from 'cor2pcor' ('corpcor' package).
The t-values are calculated via
t_{ij|S} = r_{ij|S} \cdot \sqrt{\frac{n-2-g}{1-r_{ij|S}^2}}
,
where $n$ are the number of samples and $g$ the number of controlling
variables (number of features - 2).
The p-values are calculated as follows
p_{ij|S} = 2 \cdot pt(-abs(t_{ij|S}), df = n - 2 - g)
'list' containing two matrices, the first matrix contains correlation coefficients and the second matrix contains the corresponding p-values
Thomas Naake, thomasnaake@googlemail.com
data("x_test", package = "MetNet")
x <- x_test[, 3:ncol(x_test)]
x <- as.matrix(x)
x <- t(x)
partialCorrelation(x, use = "pairwise", method = "pearson")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.