geometric.mean {psych}R Documentation

Find the geometric mean of a vector or columns of a data.frame.

Description

The geometric mean is the nth root of n products or e to the mean log of x. Useful for describing non-normal, i.e., geometric distributions.

Usage

geometric.mean(x)

Arguments

x a vector or data.frame

Details

Useful for teaching how to write functions, also useful for showing the different ways of estimating central tendency.

Value

geometric mean(s) of x or x.df.

Note

Not particularly useful if there are elements that are <= 0.

Author(s)

William Revelle

See Also

harmonic.mean, mean

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.
x <- seq(1,5)
x2 <- x^2
geometric.mean(x)
geometric.mean(x2)
## The function is currently defined as
function(x) { exp(mean(log(x))) }

[Package psych version 1.0-18 Index]