Do.sim.matrix.Pearson: Construction of the Pearson correlation matrix

View source: R/NetPreProc.R

Do.sim.matrix.PearsonR Documentation

Construction of the Pearson correlation matrix

Description

Function to obtain the Pearson correlation matrix between rows of a given matrix.

Usage

Do.sim.matrix.Pearson(M, cut = TRUE, remove.negatives = TRUE, min.thresh = 0)

Arguments

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

Details

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.

Value

a square symmetric matrix of the Pearson correlation coefficients computed between the rows of M

Examples

# 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);

NetPreProc documentation built on Sept. 19, 2022, 5:06 p.m.