geometric_mean: Geometric Mean

geometric_meanR Documentation

Geometric Mean

Description

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

(1 * 2 * 10)^\frac{1}{3}

= 2.7 not 4.3 (the arithmetic mean of utility).

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

  • harmonic_mean(), mean()

Other Miscellaneous Stats Functions: FishersMethod(), SE_from_p(), harmonic_mean(), oddsratio(), reliability(), umx, umxCov2cor(), umxHetCor(), umxParan(), umxWeightedAIC(), umx_apply(), umx_cor(), umx_means(), umx_r_test(), umx_round(), umx_scale(), umx_var()

Examples

geometric_mean(c(50, 100))

# For a given sum, geometric mean is maximised when all values are equal:
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))

tbates/umx documentation built on Sept. 19, 2024, 1:10 a.m.