geometric_mean {epiCo} | R Documentation |
Returns the geometric mean of a vector of real numbers.
Description
Function that returns the geometric mean of a vector of real numbers according to the selected method.
Usage
geometric_mean(
x,
method = c("positive", "shifted", "optimized", "weighted"),
shift = 1,
epsilon = 0.001
)
Arguments
x |
A numeric vector of real values |
method |
Description of methods:
|
shift |
= 1 (default) a positive value to use in the shifted method |
epsilon |
= 1e-5 (default) the minimum positive value to consider in the optimized method. |
Value
The geometric mean of the x vector, and the epsilon value if optimized method is used.
Examples
x <- c(4, 5, 3, 7, 8)
geometric_mean(x, method = "optimized")