sample geometric mean as a numeric vector. The default choice is
that any NA values will be kept (na.rm = FALSE). This can be
changed by specifying na.rm = TRUE, such as sgm(x, na.rm = TRUE).
Arguments
x
numeric vector that contains the sample data points (any
negative values will be ignored).
na.rm
logical vector that determines whether the missing
values should be removed or not.
"The geometric mean is used in averaging values that represent a rate of
change. It is the positive nth root of the product of the n values."
References
Nathabandu T. Kottegoda and Renzo Rosso, Statistics, Probability, and Reliability for Civil and Environmental Engineers, New York City, New York: The McGraw-Hill Companies, Inc., 1997, page 13.
shm for harmonic mean, cv for coefficient of
variation (CV), relerror for relative error, approxerror for
approximate error, rms for root-mean-square (RMS), and ranges
for sample range.
library("iemisc")
# Example 1.13 from Kottegoda (page 13)city_pop <- c(230000, 310000)
sgm(city_pop)
# Compare the geometric mean to the arithmetic meanmean(city_pop)