| urbeta | R Documentation |
UNU.RAN random variate generator for the Beta distribution with
parameters shape1 and shape2.
It also allows sampling from the truncated distribution.
[Special Generator] – Sampling Function: Beta.
urbeta(n, shape1, shape2, lb = 0, ub = 1)
n |
size of required sample. |
shape1, shape2 |
positive shape parameters of the Beta distribution. |
lb |
lower bound of (truncated) distribution. |
ub |
upper bound of (truncated) distribution. |
The Beta distribution with parameters shape1 = a and
shape2 = b has density
f(x) = \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}{x}^{a} {(1-x)}^{b}
for a > 0, b > 0 and 0 \le x \le 1.
The generation algorithm uses fast numerical inversion. The parameters
lb and ub can be used to generate variates from
the Beta distribution truncated to the interval (lb,ub).
This function is wrapper for the UNU.RAN class in R.
Compared to rbeta, urbeta is faster, especially for
larger sample sizes.
However, in opposition to rbeta vector arguments are ignored,
i.e. only the first entry is used.
Josef Leydold and Wolfgang H\"ormann unuran@statmath.wu.ac.at.
W. H\"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. Springer-Verlag, Berlin Heidelberg
runif and .Random.seed about random number
generation, unuran for the UNU.RAN class, and
rbeta for the R built-in generator.
## Create a sample of size 1000
x <- urbeta(n=1000,shape1=2,shape2=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.