noiseInjector.norm {GROAN}R Documentation

Inject Normal Noise

Description

This function adds to the passed phenotypes array noise sampled from a normal distribution with the specified mean and standard deviation.
The function can interest the totality of the passed phenotype array or a random subset of it (commanded by subset parameter).

Usage

noiseInjector.norm(phenotypes, mean = 0, sd = 1, subset = 1)

Arguments

phenotypes

an array of numbers.

mean

mean of the normal distribution.

sd

standard deviation of the normal distribution.

subset

integer in [0,1], the proportion of original dataset to be injected

Value

An array, of the same size as phenotypes, where normal noise has been added to the original phenotype values.

See Also

Other noiseInjectors: noiseInjector.dummy(), noiseInjector.swapper(), noiseInjector.unif()

Examples

#a sinusoid signal
phenos = sin(seq(0,5, 0.1))
plot(phenos, type='p', pch=16, main='Original (black) vs. Injected (red), 100% affected')

#adding normal noise to all samples
phenos.noise = noiseInjector.norm(phenos, sd = 0.2)
points(phenos.noise, type='p', col='red')

#adding noise only to 30% of the samples
plot(phenos, type='p', pch=16, main='Original (black) vs. Injected (red), 30% affected')
phenos.noise.subset = noiseInjector.norm(phenos, sd = 0.2, subset = 0.3)
points(phenos.noise.subset, type='p', col='red')

[Package GROAN version 1.3.1 Index]