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.
...
ANY
Passed to $genExp
.
cf()
Numerically estimates the characteristic function.
CoreStatistics$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
ANY
Passed to $genExp
.
pgf()
Numerically estimates the probability-generating function.
CoreStatistics$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
ANY
Passed to $genExp
.
entropy()
Numerically estimates the entropy function.
CoreStatistics$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
ANY
Passed to $genExp
.
skewness()
Numerically estimates the distribution skewness.
CoreStatistics$skewness(...)
...
ANY
Passed to $genExp
.
kurtosis()
Numerically estimates the distribution kurtosis.
CoreStatistics$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
ANY
Passed to $genExp
.
variance()
Numerically estimates the distribution variance.
CoreStatistics$variance(...)
...
ANY
Passed to $genExp
.
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.
...
ANY
Passed to $genExp
.
genExp()
Numerically estimates \(E[f(X)]\) for some function \(f\).
CoreStatistics$genExp(trafo = NULL, cubature = FALSE, ...)
trafo
function()
Transformation function to define the expectation, default is distribution mean.
cubature
logical(1)
If TRUE
uses cubature::cubintegrate for approximation, otherwise integrate.
...
ANY
Passed to cubature::cubintegrate.
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
Passed to $genExp
.
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