| DiracDistribution {rdecision} | R Documentation |
A Dirac delta function
Description
An R6 class representing a Dirac Delta function.
Details
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.
Super class
rdecision::Distribution -> DiracDistribution
Methods
Public methods
Inherited methods
Method new()
Create a new Dirac Delta function distribution.
Usage
DiracDistribution$new(const)
Arguments
constThe value at which the distribution is centred.
Returns
A new DiracDistribution object.
Method distribution()
Accessor function for the name of the distribution.
Usage
DiracDistribution$distribution()
Returns
Distribution name as character string.
Method mode()
Return the mode of the distribution.
Usage
DiracDistribution$mode()
Returns
Numeric Value where the distribution is centered.
Method mean()
Return the expected value of the distribution.
Usage
DiracDistribution$mean()
Returns
Expected value as a numeric value.
Method SD()
Return the standard deviation of the distribution.
Usage
DiracDistribution$SD()
Returns
Standard deviation as a numeric value
Method quantile()
Quantiles of the distribution.
Usage
DiracDistribution$quantile(probs)
Arguments
probsNumeric vector of probabilities, each in range [0,1].
Details
For a Dirac Delta Function all quantiles are returned as the value at which the distribution is centred.
Returns
Vector of numeric values of the same length as probs.
Method sample()
Draw and hold a random sample from the model variable.
Usage
DiracDistribution$sample(expected = FALSE)
Arguments
expectedIf TRUE, sets the next value retrieved by a call to
r()to be the mean of the distribution.
Returns
Updated distribution.
Method clone()
The objects of this class are cloneable with this method.
Usage
DiracDistribution$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Author(s)
Andrew Sims andrew.sims@newcastle.ac.uk