Skip to contents

This function calculates the \(n\)-th (raw) moment, also known as the \(n\)-th moment about zero, of a ddf distribution.

Usage

moment(dist, n)

Arguments

dist

A ddf object, the distribution.

n

An integer, the order of the moment.

Value

A double.

Details

The \(n\)-th (raw) moment of a random variable \(X\) is given by $$E[X^n],$$ where \(E\) is the expectation operator.

See also

Examples

# Expected value when throwing a six-sided dice
moment(unif(6), 1)
#> [1] 3.5