Skip to contents

A set of functions that calculate the theoretical moments (expectation, variance, skewness, excess kurtosis) and other important parametric functions (median, mode, entropy, Fisher information) of a distribution.

Usage

moments(x)

mean(x, ...)

median(x, na.rm = FALSE, ...)

mode(x)

var(x, y = NULL, na.rm = FALSE, use)

sd(x, na.rm = FALSE)

skew(x, ...)

kurt(x, ...)

entro(x, ...)

finf(x, ...)

Arguments

x

a Distribution object.

...

extra arguments.

y, use, na.rm

arguments in mean and var standard methods from the stats package not used here.

Value

Numeric, either vector or matrix depending on the moment and the distribution. The moments() function returns a list with all the available methods.

Details

Given a distribution, these functions calculate the theoretical moments and other parametric quantities of interest. Some distribution-function combinations are not available; for example, the sd() function is available only for univariate distributions.

The moments() function automatically finds the available methods for a given distribution and results all of the results in a list.

Technical Note: The argument of the moment functions does not follow the naming convention of the package, i.e. the Distribution object is names x rather than distr. This is due to the fact that most of the generics are already defined in the stats package (mean, median, mode, var, sd), therefore the first argument was already named x and could not change.

Functions

  • median(): Median

  • mode(): Mode

  • var(): Variance

  • sd(): Standard Deviation

  • skew(): Skewness

  • kurt(): Kurtosis

  • entro(): Entropy

  • finf(): Fisher Information (numeric or matrix)

Examples

# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------

# Create the distribution
D <- Beta(3, 5)

# List of all available moments
mom <- moments(D)

# Expectation
mean(D)
#> [1] 0.375
mom$mean
#> [1] 0.375

# Variance and Standard Deviation
var(D)
#> [1] 0.02604167
sd(D)
#> [1] 0.1613743

# Skewness and Excess Kurtosis
skew(D)
#> [1] 0.3098387
kurt(D)
#> [1] 0.04

# Entropy
entro(D)
#> [1] -0.4301508

# Fisher Information Matrix
finf(D)
#>            shape1      shape2
#> shape1  0.2617971 -0.13313701
#> shape2 -0.1331370  0.08818594