Defines a Uniform random variable. It uses in the backend
all functions that defines a Uniform
random variable. As
the other definitions in distributions
this is an
R6
object. Tha parametrization used
is from a $$X \sim \mathsf{U}(\alpha, \beta)\,,$$
where the parameters \(\alpha\) and \(\beta\) are
the parameters defining the support of the Uniform random variable.
Note
All random variables in distributions
are defined as R6
objects. The fields
(referenced below) are needed for objects of
R6::R6Class
. In our context these are what defines
which specific instance of a
random variable is used. That is, the public fields
are the
parameters of the random variable \(\theta \in \mathbb{R}^p\), for some
\(p\).
See also
Other continuous:
BetaRandomVariable
,
GaussianRandomVariable
Public fields
alpha
(
double
, positive)
the first parameter of the distribution, \(\alpha > 0\).beta
(
double
, positive)
the second parameter of the distribution, \(\beta > \alpha\).
Methods
Method new()
Generates a Uniform ContinuousRandomVariable
object with specified
parameters alpha (alpha
) and beta (beta
).
Usage
UniformRandomVariable$new(alpha = 0, beta = 1)
Method sample()
Generates random variables using the stats::runif()
function.
Method density()
Evaluates the density function using the stats::dunif()
function.