Skip to contents

Compositional Mean

Usage

# S4 method for CompositionMatrix
mean(x, ..., na.rm = FALSE)

Arguments

x

A CompositionMatrix object.

...

Currently not used.

na.rm

A logical scalar: should missing values be removed?

Value

A numeric vector.

Details

Closed vector of the columns geometric means.

References

Aitchison, J. (1986). The Statistical Analysis of Compositional Data. London: Chapman and Hall, p. 64-91.

See also

Other statistics: aggregate(), covariance(), dist, mahalanobis(), margin(), metric_var(), quantile(), scale(), variation()

Author

N. Frerebeau

Examples

## Data from Aitchison 1986
data("hongite")

## Coerce to compositional data
coda <- as_composition(hongite)

## Mean
mean(coda)
#>          A          B          C          D          E 
#> 0.48941415 0.21966082 0.09881294 0.10405382 0.08805827 

## Quantile
quantile(coda)
#>          A         B     C     D     E
#> 0%   0.323 0.0520000 0.007 0.055 0.037
#> 25%  0.423 0.1290000 0.038 0.083 0.065
#> 50%  0.452 0.2380000 0.097 0.095 0.085
#> 75%  0.486 0.3233233 0.234 0.109 0.098
#> 100% 0.523 0.4660000 0.429 0.158 0.132

## Metric variance
metric_var(coda)
#> [1] 1.691324

## Metric standard deviation
metric_sd(coda)
#> [1] 0.6502546