correlation {MetNet} | R Documentation |
'correlation' infers an adjacency matrix using correlation using the 'corr.test' function (from the 'psych' package), 'pcor' (from 'ppcor') or 'spcor' (from 'ppcor'). 'correlation' extracts the reported pair-wise correlation coefficients from the function 'corAndPvalue', 'pcor' or 'spcor' and will return the weighted adjacency matrix of the absolute correlation values.
correlation(x, method = "pearson", p.adjust = "none")
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", "pearson_semipartial" or "spearman_semipartial". |
p.adjust |
'character', method of p-value adjustment passed to 'p.adjust' |
If '"pearson"' or '"spearman"' is used as a 'method', the function 'corr.test' from 'psych' 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.
'method' will be passed to argument 'method' in 'corr.test' (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).
'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', 'pcor' or 'spcor' (depending on the chosen 'method') and optionally the adjusted p.values (argument 'p.adjust')
Thomas Naake, thomasnaake@googlemail.com
data("x_test", package = "MetNet") x <- x_test[1:10, 3:ncol(x_test)] x <- as.matrix(x) correlation(x, method = "pearson")