This decorator adds numeric methods for missing analytic expression in distr6 Distribution objects as well as adding generalised expectation and moments functions.

## Value

Returns a decorated R6 object inheriting from class SDistribution with the methods listed below added to the SDistribution methods.

## Details

Decorator objects add functionality to the given Distribution object by copying methods in the decorator environment to the chosen Distribution environment. See the 'Added Methods' section below to find details of the methods that are added to the Distribution. Methods already present in the distribution are not overwritten by the decorator.

Use decorate to decorate a Distribution.

All methods in this decorator use numerical approximations and therefore better results may be available from analytic computations.

CoreStatistics$new(distribution) ## Constructor Arguments  Argument Type Details distribution distribution Distribution to decorate. ## Added Methods  Method Name Link mgf(t) Moment generating function mgf pgf(t) Probability generating function pgf cf(t) Characteristic function cf entropy(base = 2) (Shannon) Entropy entropy skewness() Skewness skewness kurtosis(excess = TRUE) Kurtosis kurtosis kthmoment(type = "central") Kth Moment kthmoment genExp(trafo) Generalised Expectation genExp mode(which = "all") Mode mode variance() Variance variance mean() Arithmetic mean mean.Distribution ## See also decorate, listDecorators ## Examples x = Binomial$new()
decorate(x, CoreStatistics)#> x is now decorated with CoreStatistics#> Binom(prob = 0.5, size = 10) x$genExp()#> [1] 5 x = Binomial$new(decorators = CoreStatistics)
x\$kthmoment(4)#> Results from numeric calculations are approximate only. Better results may be available.#> [1] 17.5