Learn R Programming

RMThreshold (version 1.1)

rm.denoise.mat: Remove noise from a random matrix by applying a threshold

Description

Matrix elements with an absolute value below the given threshold are set to zero.

Usage

rm.denoise.mat(mat, threshold, keep.diag = TRUE)

Arguments

mat
The noisy input matrix.
threshold
Numerical value of the threshold.
keep.diag
A logical variable that determines if the diagonal of the matrix is thresholded or not. The default is keep.diag = T. In that case, diagonal matrix elements are not touched.

Value

Details

The function outputs the number of non-zero matrix elements before and after thresholding.

See Also

Estimate an objective threshold for signal-noise separation in random matrices: rm.matrix.validation

Examples

Run this code

set.seed(777)
random.matrix <- create.rand.mat(size = 1000, distrib = "norm")$rand.matr
dim(random.matrix)


## After identification of a proper candidate threshold:
cleaned.matrix <- rm.denoise.mat(random.matrix, threshold = 3.2, keep.diag = TRUE)	  
  

Run the code above in your browser using DataLab