An R6 class representing an empirical (1D) distribution.
Andrew J. Sims andrew.sims@newcastle.ac.uk
rdecision::Distribution
-> EmpiricalDistribution
new()
Create an object of class EmpiricalDistribution
.
EmpiricalDistribution$new(x, interpolate.sample = TRUE)
x
a sample of at least 1 numerical value from the population of interest.
interpolate.sample
Logical; if true, each call to sample()
make a random draw from \(U_{0,1}\) to find a \(p\) value, then
finds that quantile of the sample, using the quantile
function
in R, via interpolation from the eCDF. If false, the sample()
function makes a random draw from x
.
Empirical distributions based on very small sample sizes are supported, but not recommended.
An object of class EmpiricalDistribution
.
distribution()
Accessor function for the name of the distribution.
EmpiricalDistribution$distribution()
Distribution name as character string.
Expected value as a numeric value.
NA because an empirical distribution is not guaranteed to be unimodal.
SD()
Return the standard deviation of the distribution.
EmpiricalDistribution$SD()
Standard deviation as a numeric value
sample()
Draw and hold a random sample from the distribution.
EmpiricalDistribution$sample(expected = FALSE)
expected
If TRUE, sets the next value retrieved by a call to
r()
to be the mean of the distribution.
Samples with interpolation or by random draw from the
supplied distribution (see parameter interpolate.sample
in
new()
).
Updated distribution.
quantile()
Return the quantiles of the empirical uncertainty distribution.
EmpiricalDistribution$quantile(probs)
probs
Vector of probabilities, in range [0,1].
Vector of quantiles.
clone()
The objects of this class are cloneable with this method.
EmpiricalDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
An object representing an empirical distribution. It inherits
from class Distribution
.