Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

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.

Super class

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 - μ)^k]

the kth standardised moment of a distribution is defined by

SM(k)_X = CM(k)/σ^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, μ is the mean of the distribution and σ 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.

See Also

Examples

decorate(Exponential$new(), "CoreStatistics")
Exponential$new(decorators = "CoreStatistics")
CoreStatistics$new()$decorate(Exponential$new())

distr6

The Complete R6 Probability Distributions Interface

v1.5.2
MIT + file LICENSE
Authors
Raphael Sonabend [aut, cre] (<https://orcid.org/0000-0001-9225-4654>), Franz Kiraly [aut], Peter Ruckdeschel [ctb] (Author of distr), Matthias Kohl [ctb] (Author of distr), Nurul Ain Toha [ctb], Shen Chen [ctb], Jordan Deenichin [ctb], Chengyang Gao [ctb], Chloe Zhaoyuan Gu [ctb], Yunjie He [ctb], Xiaowen Huang [ctb], Shuhan Liu [ctb], Runlong Yu [ctb], Chijing Zeng [ctb], Qian Zhou [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.