geometric.mean: Find the geometric mean of a vector or columns of a...

Description Usage Arguments Details Value Note Author(s) See Also Examples

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

1

Arguments

x

a vector or data.frame

na.rm

remove NA values before processing

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

1
2
3
4
5
6
7
8
x <- seq(1,5)
x2 <- x^2
x2[2] <- NA
X <- data.frame(x,x2)
geometric.mean(x)
geometric.mean(x2)
geometric.mean(X)
geometric.mean(X,na.rm=FALSE)

psych documentation built on May 29, 2017, 8:25 p.m.

Search within the psych package
Search all R packages, documentation and source code