Skip to contents

A moment of a distribution, analytically or by integration

Usage

morie_dist_moment(
  dist,
  order = 1L,
  central = order >= 2L,
  method = c("analytic", "numeric")
)

Arguments

dist

A morie_distribution.

order

Moment order (1 = mean, 2 = variance about the mean when central = TRUE).

central

Whether to return the central moment (default TRUE for order >= 2).

method

"analytic" uses the closed form where available and otherwise falls back to "numeric"; "numeric" forces integration. The numeric path is justified only where no closed form exists.

Value

The requested moment (numeric scalar).

Examples

morie_dist_moment(morie_distribution("gamma", shape = 2, rate = 1), 1)
#> [1] 2