Compute the log-average or geometric mean of a numeric vector
1 2 3 4
numeric vector of positive values
numeric scalar, the number of standard deviations to add
Implements the geometric mean, by log transforming the values in
that mean, and then exponentiating the result. This has better numerical stability then
then using the N-th root of the power series of
The 'PlusSD' forms are used to thresholds of statistical significance, by adding an
arbitrary number of standard deviation of
log(x), to the calculation.
As log transform is undefined for zeros and negative values, some level of data cleaning is implemented to tolerate invalid data. Specifically, negatives are set to NA and thus ignored. If all values are zero, zero is returned. If a subset of values are zero, they are replaced with the smallest non-zero value prior to log transform and averaging.
a numeric scalar
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.