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 June 22, 2024, 9:24 a.m.