vfd {simEd} | R Documentation |
Variate Generation for FALSE Distribution
Description
Variate Generation for FALSE Distribution
Usage
vfd(n, df1, df2, ncp = 0, stream = NULL, antithetic = FALSE, asList = FALSE)
Arguments
n |
number of observations |
df1 |
Degrees of freedom > 0 |
df2 |
Degrees of freedom > 0 |
ncp |
Non-centrality parameter >= 0 |
stream |
if |
antithetic |
if |
asList |
if |
Details
Generates random variates from the FALSE distribution.
FALSE 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::qf
is used to
invert the uniform(0,1) variate(s).
In this way, using vfd
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 F distribution with df1
= n_1
and df2
= n_2
degrees of freedom has density
f(x) = \frac {\Gamma(n_1/2 + n_2/2)} {\Gamma(n_1/2) \ \Gamma(n_2/2)}
\left( \frac{n_1}{n_2} \right)^{n_1/2} x^{n_1/2 - 1}
\left( 1 + \frac{n_1x}{n_2} \right) ^ {-(n_1 + n_2)/2}
for x > 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 FALSE 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::qf
vfd(3, df1 = 1, df2 = 2, ncp = 10)
set.seed(8675309)
# NOTE: following inverts rstream::rstream.sample using stats::qf
vfd(3, 5, 5, stream = 1)
vfd(3, 5, 5, stream = 2)
set.seed(8675309)
# NOTE: following inverts rstream::rstream.sample using stats::qf
vfd(1, 5, 5, stream = 1)
vfd(1, 5, 5, stream = 2)
vfd(1, 5, 5, stream = 1)
vfd(1, 5, 5, stream = 2)
vfd(1, 5, 5, stream = 1)
vfd(1, 5, 5, stream = 2)
set.seed(8675309)
variates <- vfd(100, 5, 5, stream = 1)
set.seed(8675309)
variates <- vfd(100, 5, 5, stream = 1, antithetic = TRUE)