View source: R/noise_injectors.R
noiseInjector.norm | R Documentation |
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).
noiseInjector.norm(phenotypes, mean = 0, sd = 1, subset = 1)
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 |
An array, of the same size as phenotypes, where normal noise has been added to the original phenotype values.
Other noiseInjectors:
noiseInjector.dummy()
,
noiseInjector.swapper()
,
noiseInjector.unif()
#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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.