View source: R/noise_injectors.R
noiseInjector.unif | R Documentation |
This function adds to the passed phenotypes
array noise sampled from
a uniform distribution with the specified range.
The function can interest the totality of the passed phenotype array or
a random subset of it (commanded by subset
parameter).
noiseInjector.unif(phenotypes, min = 0, max = 1, subset = 1)
phenotypes |
an array of numbers. |
min, max |
lower and upper limits of the distribution. Must be finite. |
subset |
integer in [0,1], the proportion of original dataset to be injected |
An array, of the same size as phenotypes, where uniform noise has been added to the original phenotype values.
Other noiseInjectors:
noiseInjector.dummy()
,
noiseInjector.norm()
,
noiseInjector.swapper()
#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.unif(phenos, min=0.1, max=0.3) 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.unif(phenos, min=0.1, max=0.3, 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.