rbeta_rs2 | R Documentation |
Generate random numbers from a beta distribution, rescaled to have user-specified population mean and standard deviation, and within a specific range.
rbeta_rs2(n = 10, bmean, bsd, blow = 0, bhigh = 1)
n |
The number of random numbers to generate. |
bmean |
The population mean. |
bsd |
The population standard
deviation. If |
blow |
The lower bound of the target range. |
bhigh |
The upper bound of the target range. |
First, specify the two parameters,
shape1
and shape2
, and the
desired population mean and standard
deviation. The random numbers, drawn
from a beta distribution by
stats::rbeta()
will then be
rescaled to the desired population range.
A vector of the generated random numbers.
set.seed(90870962)
x <- rbeta_rs2(n = 5000,
bmean = .80,
bsd = .10,
blow = .00,
bhigh = .95)
mean(x)
sd(x)
hist(x)
y <- rbeta_rs2(n = 5000,
bmean = 4,
bsd = 3,
blow = -10,
bhigh = 10)
mean(y)
sd(y)
hist(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.