Learn R Programming

distr6 (version 1.0.0)

genExp: Generalised Expectation of a Distribution

Description

A generalised expectation function for distributions, for arithmetic mean and more complex numeric calculations.

Usage

genExp(object, trafo = NULL)

Arguments

object

Distribution.

trafo

transformation for expectation calculation, see details.

Value

The given expectation as a numeric, otherwise NULL.

R6 Usage

$genExp(trafo = NULL)

Details

The expectation of a probability distribution can be numerically calculated in a variety of different ways, some more efficient than others depending on what is available, this function first checks which analytic methods are present before selecting a numeric strategy.

If trafo = NULL, then the arithmetic mean is calculated, i.e. the approximation to \(E[X]\). Any transformation must be given as a function, for example trafo = function(x) x^2 (which is the second moment).

Can only be used after decorating with CoreStatistics.

See Also

mean, CoreStatistics and decorate.