geomMean: Compute geometric mean.

View source: R/stats-utility.R

geomMeanR Documentation

Compute geometric mean.

Description

The geometric mean is computed as: \exp(\bar{log(x)}), with:

  • log: natural logarithm

  • \bar{log(x)}: arithmetic mean of log(x)

Usage

geomMean(x, na.rm = FALSE)

Arguments

x

Numeric vector.

na.rm

Logical, should NA value(s) be removed (FALSE by default)?

Value

Numeric vector of length 1 with geometric mean.

Author(s)

Laure Cougnaud

See Also

Other stats utility functions: cv(), geomCV(), geomSD(), geomSE(), se()

Examples

# geometric mean of a big sample from log normal distribution
# tends to the mean of the distribution:
geomMean(rlnorm(n = 1000, meanlog = 0, sdlog = 1))

inTextSummaryTable documentation built on Sept. 12, 2023, 5:06 p.m.