R/DistributionDecorator_CoreStatistics.R
CoreStatistics.Rd
This decorator adds numeric methods for missing analytic expressions in Distributions as well as adding generalised expectation and moments functions.
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
distr6::DistributionDecorator
-> CoreStatistics
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"), ...)
genExp()
Numerically estimates \(E[f(X)]\) for some function \(f\).
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.
mean()
Numerically estimates the distribution mean.
decorate(Exponential$new(), "CoreStatistics")
#> Exponential is now decorated with CoreStatistics
#> Exp(rate = 1)
Exponential$new(decorators = "CoreStatistics")
#> Exp(rate = 1)
CoreStatistics$new()$decorate(Exponential$new())
#> Exponential is now decorated with CoreStatistics