ATC {cola} | R Documentation |
Ability to correlate other rows in the matrix
ATC(mat, cor_fun = stat::cor, min_cor = 0, power = 1, mc.cores = 1, n_sampling = 1000, q_sd = 0, ...)
mat |
A numeric matrix. ATC score is calculated by rows. |
cor_fun |
A function which calculates correlations. |
min_cor |
Cutoff for the minimal absolute correlation. |
power |
Power on the correlation values. |
mc.cores |
Mumber of cores. |
n_sampling |
When there are too many rows in the matrix, to get the curmulative distribution of how one row correlates other rows, actually we don't need to use all the rows in the matrix, e.g. 1000 rows can already give a very nice estimation. |
q_sd |
Percentile of the standard deviation for the rows. Rows with values less than it are ignored. |
... |
Pass to |
For a given row in a matrix, the ATC score is the area above the curve of the curmulative density
distribution of the absolute correlation to all other rows. Formally, if F_i(X)
is the
cumulative distribution function of X
where X
is the absolute correlation for row i with power power
(i.e. x = cor^power
),
ATC_i = 1 - \int_{min_cor}^1 F_i(X)
.
By default the ATC scores are calculated by Pearson correlation, to use Spearman correlation, you can register the top-value method by:
register_top_value_methods( "ATC_spearman" = function(m) ATC(m, method = "spearman") )
Similarly, to use a robust correlation method, e.g. bicor
function, you can do like:
register_top_value_methods( "ATC_bicor" = function(m) ATC(m, cor_fun = WGCNA::bicor) )
A vector of numeric values with the same order as rows in the input matrix.
Zuguang Gu <z.gu@dkfz.de>
set.seed(12345) nr1 = 100 mat1 = matrix(rnorm(100*nr1), nrow = nr1) nr2 = 10 require(mvtnorm) sigma = matrix(0.8, nrow = nr2, ncol = nr2); diag(sigma) = 1 mat2 = t(rmvnorm(100, mean = rep(0, nr2), sigma = sigma)) nr3 = 50 sigma = matrix(0.5, nrow = nr3, ncol = nr3); diag(sigma) = 1 mat3 = t(rmvnorm(100, mean = rep(0, nr3), sigma = sigma)) mat = rbind(mat1, mat2, mat3) ATC_score = ATC(mat) plot(ATC_score, pch = 16, col = c(rep(1, nr1), rep(2, nr2), rep(3, nr3)))