Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

geometric_mean

Geometric Mean


Description

The Geometric mean is the nth-root of the product of n input values. Common uses include computing economic utility. That is to say, the utility of c(1, 2, 10) is

(1 * 2 * 10)/3

= 6.6 not 6.3 (the arithmetic mean).

Usage

geometric_mean(x, na.rm = c(TRUE, FALSE))

Arguments

x

A vector of values.

na.rm

remove NAs by default.

Value

  • Geometric mean of x

References

See Also

Examples

geometric_mean(c(50, 100))

# For a given sum, geometric mean is maximised with equality
geometric_mean(c(75,75))

v = c(1, 149); c(sum(v), geometric_mean(v), mean(v), median(v))
# 150.00000  12.20656  75.00000  75.00000

# Underlying logic
sqrt(50 * 100)

# Alternate form using logs
exp(mean(log(c(50 *100))))

# Reciprocal duality
1/geometric_mean(c(100, 50))
geometric_mean(c(1/100, 1/50))

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.