This decorator adds numeric methods for missing analytic expressions in Distributions as well as adding generalised expectation and moments functions.
distr6::DistributionDecorator
-> CoreStatistics
mgf()
Numerically estimates the moment-generating function.
CoreStatistics$mgf(t)
t
(integer(1))
t integer to evaluate function at.
cf()
Numerically estimates the characteristic function.
CoreStatistics$cf(t)
t
(integer(1))
t integer to evaluate function at.
pgf()
Numerically estimates the probability-generating function.
CoreStatistics$pgf(z)
z
(integer(1))
z integer to evaluate probability generating function at.
entropy()
Numerically estimates the entropy function.
CoreStatistics$entropy(base = 2)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
skewness()
Numerically estimates the distribution skewness.
CoreStatistics$skewness()
kurtosis()
Numerically estimates the distribution kurtosis.
CoreStatistics$kurtosis(excess = TRUE)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
variance()
Numerically estimates the distribution variance.
CoreStatistics$variance()
kthmoment()
The kth central moment of a distribution is defined by $$CM(k)_X = E_X[(x - \mu)^k]$$ the kth standardised moment of a distribution is defined by $$SM(k)_X = \frac{CM(k)}{\sigma^k}$$ the kth raw moment of a distribution is defined by $$RM(k)_X = E_X[x^k]$$ where \(E_X\) is the expectation of distribution X, \(\mu\) is the mean of the distribution and \(\sigma\) is the standard deviation of the distribution.
CoreStatistics$kthmoment(k, type = c("central", "standard", "raw"))
k
integer(1)
The k
-th moment to evaluate the distribution at.
type
character(1)
Type of moment to evaluate.
genExp()
Numerically estimates \(E[f(X)]\) for some function \(f\).
CoreStatistics$genExp(trafo = NULL)
trafo
function()
Transformation function to define the expectation, default is distribution mean.
mode()
Numerically estimates the distribution mode.
CoreStatistics$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
mean()
Numerically estimates the distribution mean.
CoreStatistics$mean(...)
...
ANY
Ignored, added for consistency.
clone()
The objects of this class are cloneable with this method.
CoreStatistics$clone(deep = FALSE)
deep
Whether to make a deep clone.
Decorator objects add functionality to the given Distribution object by copying methods in the decorator environment to the chosen Distribution environment.
All methods implemented in decorators try to exploit analytical results where possible, otherwise numerical results are used with a message.
Other decorators:
ExoticStatistics
,
FunctionImputation
# NOT RUN {
decorate(Exponential$new(), "CoreStatistics")
Exponential$new(decorators = "CoreStatistics")
CoreStatistics$new()$decorate(Exponential$new())
# }
Run the code above in your browser using DataLab