Skip to contents
  • metric_var() computes the metric variance (or total variance), i.e. a global measure of spread.

  • metric_sd() computes the metric standard deviation.

Usage

metric_var(x, ...)

metric_sd(x, ...)

# S4 method for CompositionMatrix
metric_var(x)

# S4 method for CompositionMatrix
metric_sd(x)

Arguments

x

A CompositionMatrix object.

...

Currently not used.

Value

A numeric vector.

Details

The metric variance is the average of the CLR variances.

References

Boogaart, K. G. van den & Tolosana-Delgado, R. (2013). Analyzing Compositional Data with R. Berlin Heidelberg: Springer-Verlag. doi:10.1007/978-3-642-36809-7 .

Hron, K. & Kubáček. L. (2011). Statistical Properties of the Total Variation Estimator for Compositional Data. Metrika, 74 (2): 221-230. doi:10.1007/s00184-010-0299-3 .

Pawlowsky-Glahn, V. & Egozcue, J. J. (2001). Geometric Approach to Statistical Analysis on the Simplex. Stochastic Environmental Research and Risk Assessment, 15(5): 384-398. doi:10.1007/s004770100077 .

See also

Other statistics: aggregate(), condense(), covariance(), dist, mahalanobis(), margin(), mean(), pip(), 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