distr6 (version 1.6.9)

CoreStatistics: Core Statistical Methods Decorator

Description

This decorator adds numeric methods for missing analytic expressions in Distributions as well as adding generalised expectation and moments functions.

Arguments

Super class

distr6::DistributionDecorator -> CoreStatistics

Methods

Public methods

Method mgf()

Numerically estimates the moment-generating function.

Usage

CoreStatistics$mgf(t, ...)

Arguments

t

(integer(1)) t integer to evaluate function at.

...

ANY Passed to $genExp.

Method cf()

Numerically estimates the characteristic function.

Usage

CoreStatistics$cf(t, ...)

Arguments

t

(integer(1)) t integer to evaluate function at.

...

ANY Passed to $genExp.

Method pgf()

Numerically estimates the probability-generating function.

Usage

CoreStatistics$pgf(z, ...)

Arguments

z

(integer(1)) z integer to evaluate probability generating function at.

...

ANY Passed to $genExp.

Method entropy()

Numerically estimates the entropy function.

Usage

CoreStatistics$entropy(base = 2, ...)

Arguments

base

(integer(1)) Base of the entropy logarithm, default = 2 (Shannon entropy)

...

ANY Passed to $genExp.

Method skewness()

Numerically estimates the distribution skewness.

Usage

CoreStatistics$skewness(...)

Arguments

...

ANY Passed to $genExp.

Method kurtosis()

Numerically estimates the distribution kurtosis.

Usage

CoreStatistics$kurtosis(excess = TRUE, ...)

Arguments

excess

(logical(1)) If TRUE (default) excess kurtosis returned.

...

ANY Passed to $genExp.

Method variance()

Numerically estimates the distribution variance.

Usage

CoreStatistics$variance(...)

Arguments

...

ANY Passed to $genExp.

Method 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.

Usage

CoreStatistics$kthmoment(k, type = c("central", "standard", "raw"), ...)

Arguments

k

integer(1) The k-th moment to evaluate the distribution at.

type

character(1) Type of moment to evaluate.

...

ANY Passed to $genExp.

Method genExp()

Numerically estimates \(E[f(X)]\) for some function \(f\).

Usage

CoreStatistics$genExp(trafo = NULL, cubature = FALSE, ...)

Arguments

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.

Method mode()

Numerically estimates the distribution mode.

Usage

CoreStatistics$mode(which = "all")

Arguments

which

(character(1) | numeric(1) Ignored if distribution is unimodal. Otherwise "all" returns all modes, otherwise specifies which mode to return.

Method mean()

Numerically estimates the distribution mean.

Usage

CoreStatistics$mean(...)

Arguments

...

ANY Passed to $genExp.

Method clone()

The objects of this class are cloneable with this method.

Usage

CoreStatistics$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

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.

See Also

Other decorators: ExoticStatistics, FunctionImputation

Examples

Run this code
# NOT RUN {
decorate(Exponential$new(), "CoreStatistics")
Exponential$new(decorators = "CoreStatistics")
CoreStatistics$new()$decorate(Exponential$new())
# }

Run the code above in your browser using DataLab