Gmean(x, method = c("classic", "boot"), conf.level = NA, sides = c("two.sided","left","right"), na.rm = FALSE, ...)
Gsd(x, na.rm = FALSE)
"classic"
, "boot"
.
See boot.ci
.NA
."two.sided"
(default), "left"
or "right"
. You can specify just the initial letter. "left"
would be analogue to a hypothesis of "greater"
in a t.test
.NA
values should be stripped before the computation proceeds. Defaults to FALSE
.boot
function. Supported arguments are type
("norm"
, "basic"
, "stud"
, "perc"
, "bca"
), parallel
and the number of bootstrap replicates R
. If not defined those will be set to their defaults, being "basic"
for type
, option "boot.parallel"
(and if that is not set, "no"
) for parallel
and 999
for R
.
log(x)
is first calculated, before the arithmetic mean and its confidence interval are computed by MeanCI
.So 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, the result will be NA
. If any argument is zero, then the geometric mean is zero.
The geometric mean is defined as $$\sqrt[n]{x_{1}\cdot x_{2}\cdot x_{3} \ldots \cdot x_{n}}$$
and its confidence interval is given as exp(MeanCI(log(x)))
.
Use sapply
to calculate the measures from data frame, resp. from a matrix.
mean
, Hmean
x <- runif(5)
Gmean(x)
m <- matrix(runif(50), nrow = 10)
apply(m, 2, Gmean)
sapply(as.data.frame(m), Gmean)
Run the code above in your browser using DataLab