An R6 class representing a Dirac Delta function.
Andrew Sims andrew.sims@newcastle.ac.uk
rdecision::Distribution
-> DiracDistributon
new()
Create a new Dirac Delta function distribution.
DiracDistribution$new(const)
const
The value at which the distribution is centred.
A new DiracDistribution
object.
distribution()
Accessor function for the name of the distribution.
DiracDistribution$distribution()
Distribution name as character string.
Numeric Value where the distribution is centred.
Expected value as a numeric value.
SD()
Return the standard deviation of the distribution.
DiracDistribution$SD()
Standard deviation as a numeric value
probs
Numeric vector of probabilities, each in range [0,1].
For a Dirac Delta Function all quantiles are returned as the value at which the distribution is centred.
Vector of numeric values of the same length as probs
.
sample()
Draw and hold a random sample from the model variable.
DiracDistribution$sample(expected = FALSE)
expected
If TRUE, sets the next value retrieved by a call to
r()
to be the mean of the distribution.
Updated distribution.
clone()
The objects of this class are cloneable with this method.
DiracDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
A distribution modelled by a Dirac delta function \(\delta(x-c)\)
where \(c\) is the hyperparameter (value of the constant). It has
probability 1 that the value will be equal to \(c\) and zero otherwise.
The mode, mean, quantiles and random samples are all equal to \(c\). It is
acknowledged that there is debate over whether Dirac delta functions are
true distributions, but the assumption makes little practical difference in
this case. Inherits from class Distribution
.