A collection of functions for randomly generating deviates from probability
beta_rng( shape1 = 1, shape2 = 1, mean = NULL, sd = NULL, names = NULL, n = parent.frame()$n ) dirichlet_rng(alpha, names = NULL, n = parent.frame()$n) fixed(est, names = NULL, n = parent.frame()$n) custom(x, names = NULL, n = parent.frame()$n) gamma_rng(mean, sd, names = NULL, n = parent.frame()$n) lognormal_rng(meanlog, sdlog, names = NULL, n = parent.frame()$n) multi_normal_rng(mu, Sigma, names = NULL, n = parent.frame()$n, ...) normal_rng(mean, sd, names = NULL, n = parent.frame()$n) uniform_rng(min, max, names = NULL, n = parent.frame()$n)
Non-negative parameters of the Beta distribution.
Mean and standard deviation of the random variable.
Names for columns if an object with multiple columns is returned by the function.
The number of random samples of the parameters to draw. Default is
the value of
A matrix where each row is a separate vector of shape parameters.
A vector of estimates of the variable of interest.
Mean and standard deviation of the distribution on the log scale.
Additional arguments to pass to underlying random number generation functions. See "details".
Lower and upper limits of the distribution. Must be finite.
Functions either return a vector of length
n or an
Multivariate distributions always return a
data.table. If a
univariate distribution is used, then a
data.table is returned if each
parameter is specified as a vector with length greater than 1; otherwise, if
parameters are scalars, then a vector is returned. In the
k is equal to the length of the parameter vectors
entered as arguments. For example, if the probability distribution contained
mean as an argument and
of length 3, then an
n by 3 matrix would be returned. The length of all
parameter vectors must be the same. For instance, if the vector
were of length 3 then all additional parameters (e.g.,
must also be of length 3.
data.table is returned by a distribution, then its column names are set
according to the following hierarchy:
names argument if it is not
With the names of the parameter vectors if they are named vectors. If there
are multiple parameter vector arguments, then the names of the first parameter
vector with non
NULL names is used. For instance, if
both arguments to a random number generation function and
mean is a
named vector, then the names from the vector
mean are used.
vk if the
names argument is
NULL and there are no
named parameter vectors.
These functions are not exported and are meant for use with
define_rng(). They consequently assume that the number of samples to draw,
is defined in the parent environment. Convenience random number generation
Use previously sampled values from a custom probability distribution.
There are three possibilities: (i) if
n is equal to the number previously
sampled values (say
x is returned as is; (ii) if
n_samples, then samples from
x are sampled without replacement;
and (iii) if
n_samples, then samples from
x are sampled with replacement
and a warning is provided.
Dirichlet variates for each row in the matrix are
rdirichlet_mat(). The sampled values are stored in a
where there is a column for each element of
(with elements ordered rowwise).
This function should be used when values of the variable
of interest are fixed (i.e., they are known with certainty). If
length(est) > 1,
data.table is returned meaning that each element of
n times; otherwise (if
length(est) == 1), a vector is returned
est is repeated
Lognormal variates are generated with
Multivariate normal variates are generated with
Normal variates are generated with
Uniform variates are generated with