Do.sim.matrix.Pearson | R Documentation |
Function to obtain the Pearson correlation matrix between rows of a given matrix.
Do.sim.matrix.Pearson(M, cut = TRUE, remove.negatives = TRUE, min.thresh = 0)
M |
input matrix |
cut |
if TRUE (def.) at least one edge is maintained for each node, all the other edges are set to 0. If false no edgeis set to 0. |
remove.negatives |
if TRUE (def) negative values are replaced with 0 in the correlation matrix |
min.thresh |
minimum allowed threshold (def. 0). If a threshold lower than min.thresh is selected, thanit is substituted by min.thresh. Warning: setting min.thresh to large values may lead to highly disconneted network |
You can also "sparsify" the matrix, by putting to 0 all the weights, by setting a threshold such that at least one edge is maintained for each node. The diagonal values are set to 0.
a square symmetric matrix of the Pearson correlation coefficients computed between the rows of M
# a gaussian random matrix D <- matrix(rnorm(20000),nrow=200); W <- Do.sim.matrix.Pearson (D); # the same without default parameters W2 <- Do.sim.matrix.Pearson (D, cut=FALSE, remove.negatives=FALSE, min.thresh=-20);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.