variance_total: Total Variance

variance_totalR Documentation

Total Variance

Description

Computes the total (or metric) variance, a global measure of spread.

Usage

variance_total(x, ...)

## S4 method for signature 'CompositionMatrix'
variance_total(x, sd = FALSE)

## S4 method for signature 'LogRatio'
variance_total(x, row_weights = NULL, column_weights = TRUE)

Arguments

x

A CompositionMatrix object.

...

Currently not used.

sd

A logical scalar: should the metric standard deviation be returned instead of the metric variance?

row_weights

A numeric vector of row weights. If NULL (the default), equal weights are used.

column_weights

A logical scalar: should the weights of the log-ratio be used? If FALSE, equally-weighted parts are used. Alternatively, a positive numeric vector of weights can be specified.

Details

Two methods are available, see below.

Value

A numeric vector.

Methods (by class)

  • variance_total(CompositionMatrix): The total variance of compositional data is the trace of the centred log-ratio covariance matrix (i.e. totvar1 in Aitchison 1997).

  • variance_total(LogRatio): Computes the total log-ratio variance. This is identical to the weighted sum-of-squared distances between samples (i.e. totvar2 in Aitchison 1997).

Author(s)

N. Frerebeau

References

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

Aitchison, J. (1997). The One-Hour Course in Compositional Data Analysis or Compositional Data Analysis Is Simple. In V. Pawlowsky-Glahn (ed.), IAMG'97. Barcelona: International Center for Numerical Methods in Engineering (CIMNE), p. 3-35.

Boogaart, K. G. van den & Tolosana-Delgado, R. (2013). Analyzing Compositional Data with R. Berlin Heidelberg: Springer-Verlag. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-642-36809-7")}.

Greenacre, M. J. (2019). Compositional Data Analysis in Practice. Boca Raton: CRC Press.

Hron, K. & Kubáček. L. (2011). Statistical Properties of the Total Variation Estimator for Compositional Data. Metrika, 74 (2): 221-230. \Sexpr[results=rd]{tools:::Rd_expr_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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s004770100077")}.

See Also

Other statistics: aggregate(), condense(), covariance(), dist, mahalanobis(), margin(), mean(), pip(), quantile(), scale(), variance(), variation()

Examples

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

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

## Total variance (1)
variance_total(coda)

## Metric standard deviation
variance_total(coda, sd = TRUE)

## CLR transformation
clr <- transform_clr(coda)

## Individual log-ratio variances
variance(clr)

## Total log-ratio variance (2)
variance_total(clr)

## Proportionality between (1) and (2)
## See Aitchison 1997
variance_total(coda) * (1 / ncol(coda)) * (1 - (1 / nrow(coda)))

nexus documentation built on Sept. 11, 2024, 6:43 p.m.