add.Gaussian.noise: Add Gaussian noise to a matrix

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

The function adds Gaussian (i.e. normally distributed) noise to a matrix.

Usage

1
add.Gaussian.noise(mat, mean = 0, stddev = 1, symm = TRUE)

Arguments

mat

Input matrix.

mean

Mean of the Gaussian noise to be added.

stddev

Standard deviation of the Gaussian noise to be added.

symm

A logical variable that determines if the matrix is to be symmetrized after adding the noise.

Details

The function uses the rnorm function to create the normally distributed noise and adds it to the input matrix. Optionally, the matrix is symmetrized by adding it's transpose and dividing by √ 2.

Value

The input matrix with noise added, optionally symmetrized.

Note

The matrix can not be symmetrized if it is not quadratic.

Author(s)

Uwe Menzel <uwemenzel@gmail.com>

References

https://en.wikipedia.org/wiki/Gaussian_noise

See Also

Random generation for the normal distribution: rnorm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
N = 500
some.mat = matrix(rep(1, N*N), nrow = N)	
some.mat[1:3, 1:10]
res <- rm.matrix.validation(some.mat)		# not really a proper matrix for this approach.

## End(Not run)

## It can help to add Gaussian noise to an improper matrix
## Not run: 
noisy.matrix <- add.Gaussian.noise(some.mat, mean = 0, stddev = 1, symm = TRUE)
noisy.matrix[1:3, 1:10]
res <- rm.matrix.validation(noisy.matrix)	# better!
res <- rm.get.threshold(noisy.matrix)		# about 4.3	

## End(Not run)

RMThreshold documentation built on May 2, 2019, 8:51 a.m.