Calculates the geometric mean and the geometric standard deviation of a vector x.
Usage
Gmean(x, na.rm = FALSE)
Gsd(x, na.rm = FALSE)
Arguments
x
a positive numeric vector. An object which is not a vector is coerced (if possible) by as.vector.
na.rm
logical, indicating whether NA values should be stripped before the computation proceeds. Defaults to FALSE.
Value
a numeric value.
Details
The geometric mean and geometric sd are restricted to positive inputs (because otherwise the answer can have an imaginary component). Hence if any argument is negative, then the result is NA. If any argument is zero, then the geometric mean is zero.
It is defined as
$$\sqrt[n]{x_{1}\cdot x_{2}\cdot x_{3} \ldots \cdot x_{n}}$$
Use sapply to calculate the measures from data frame, resp. from a matrix.