| vbeta | R Documentation | 
Variate Generation for Beta Distribution
vbeta(
  n,
  shape1,
  shape2,
  ncp = 0,
  stream = NULL,
  antithetic = FALSE,
  asList = FALSE
)
| n | number of observations | 
| shape1 | Shape parameter 1 (alpha) | 
| shape2 | Shape parameter 2 (beta) | 
| ncp | Non-centrality parameter (default 0) | 
| stream | if  | 
| antithetic | if  | 
| asList | if  | 
Generates random variates from the beta distribution.
Beta variates are generated by inverting uniform(0,1) variates
produced either by stats::runif (if stream is
NULL) or by rstream.sample
(if stream is not NULL).
In either case, stats::qbeta is used to
invert the uniform(0,1) variate(s).
In this way, using vbeta provides a monotone and synchronized
binomial variate generator, although not particularly fast.
The stream indicated must be an integer between 1 and 25 inclusive.
The beta distribution has density
\deqn{f(x) = \frac{\Gamma(a+b)}{\Gamma(a) \ \Gamma(b)} x^{a-1}(1-x)^{b-1}}{
          f(x) = Gamma(a+b)/(Gamma(a)Gamma(b)) x^(a-1)(1-x)^(b-1)}
for a > 0, b > 0 and 0 \leq x \leq 1 where the
boundary values at x=0 or x=1 are defined as by continuity (as limits).
The mean is \frac{a}{a+b} and the variance is
{ab}{(a+b)^2 (a+b+1)}
If asList is FALSE (default), return a vector of random variates.
Otherwise, return a list with components suitable for visualizing inversion, specifically:
| u | A vector of generated U(0,1) variates | 
| x | A vector of beta random variates | 
| quantile | Parameterized quantile function | 
| text | Parameterized title of distribution | 
Barry Lawson (blawson@bates.edu), 
Larry Leemis (leemis@math.wm.edu), 
Vadim Kudlay (vkudlay@nvidia.com)
rstream, set.seed,
stats::runif
stats::rbeta
 set.seed(8675309)
 # NOTE: following inverts rstream::rstream.sample using stats::qbeta
 vbeta(3, shape1 = 3, shape2 = 1, ncp = 2)
 set.seed(8675309)
 # NOTE: following inverts rstream::rstream.sample using stats::qbeta
 vbeta(3, 3, 1, stream = 1)
 vbeta(3, 3, 1, stream = 2)
 set.seed(8675309)
 # NOTE: following inverts rstream::rstream.sample using stats::qbeta
 vbeta(1, 3, 1, stream = 1)
 vbeta(1, 3, 1, stream = 2)
 vbeta(1, 3, 1, stream = 1)
 vbeta(1, 3, 1, stream = 2)
 vbeta(1, 3, 1, stream = 1)
 vbeta(1, 3, 1, stream = 2)
 set.seed(8675309)
 variates <- vbeta(100, 3, 1, stream = 1)
 set.seed(8675309)
 variates <- vbeta(100, 3, 1, stream = 1, antithetic = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.