vweibull {simEd} | R Documentation |
Variate Generation for Weibull Distribution
Description
Variate Generation for Weibull Distribution
Usage
vweibull(
n,
shape,
scale = 1,
stream = NULL,
antithetic = FALSE,
asList = FALSE
)
Arguments
n |
number of observations |
shape |
Shape parameter |
scale |
Scale parameter (default 1) |
stream |
if |
antithetic |
if |
asList |
if |
Details
Generates random variates from the Weibull distribution.
Weibull variates are generated by inverting uniform(0,1) variates
produced either by stats::runif
(if stream
is
NULL
) or by rstream::rstream.sample
(if stream
is not NULL
).
In either case, stats::qweibull
is used to
invert the uniform(0,1) variate(s).
In this way, using vweibull
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 Weibull distribution with parameters shape
= a
and
scale
= b
has density
\deqn{f(x) = \frac{a}{b} \left(\frac{x}{b}\right)^{a-1} e^{-(x/b)^a}}{ f(x) = (a/b) (x/b)^(a-1) exp(-(x/b)^a)}
for x \ge 0
, a > 0
, and b > 0
.
Value
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 Weibull random variates |
quantile |
Parameterized quantile function |
text |
Parameterized title of distribution |
Author(s)
Barry Lawson (blawson@bates.edu),
Larry Leemis (leemis@math.wm.edu),
Vadim Kudlay (vkudlay@nvidia.com)
See Also
rstream
, set.seed
,
stats::runif
Examples
set.seed(8675309)
# NOTE: following inverts rstream::rstream.sample using stats::qweibull
vweibull(3, shape = 2, scale = 1)
set.seed(8675309)
# NOTE: following inverts rstream::rstream.sample using stats::qweibull
vweibull(3, 2, 1, stream = 1)
vweibull(3, 2, 1, stream = 2)
set.seed(8675309)
# NOTE: following inverts rstream::rstream.sample using stats::qweibull
vweibull(1, 2, 1, stream = 1)
vweibull(1, 2, 1, stream = 2)
vweibull(1, 2, 1, stream = 1)
vweibull(1, 2, 1, stream = 2)
vweibull(1, 2, 1, stream = 1)
vweibull(1, 2, 1, stream = 2)
set.seed(8675309)
variates <- vweibull(100, 2, 1, stream = 1)
set.seed(8675309)
variates <- vweibull(100, 2, 1, stream = 1, antithetic = TRUE)