View source: R/simulation.R View source: R/original/Additional file 2.R
simulate_rel_sd | R Documentation |
Simulates relative standard deviations (coefficients of variation) using a mixture of 2 normal distributions (one subpopulation of less variable measurements and on subpopulation of more variable ones).
simulate_rel_sd(n, par1, par2 = NULL, p = 0.05, con = c(0, 1))
n |
Number of samples to draw. |
par1 |
Parameters (mean, sd) for first distribution. |
par2 |
Optional parameters (mean, sd) for second distribution. |
p |
Proportion of samples to draw using |
con |
Optional vector of lower and upper constraints on generated samples. By default, relative standard deviations are limited to between 0 and 1. |
A vector of relative standard deviation values.
out <- simulate_rel_sd(10000, c(.04, .02), c(0.11, 0.02), 0.7, c(0, 0.20))
hist(out, 20, probability = TRUE,
main = '', xlab = 'Relative standard deviation')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.