covariance {nexus}R Documentation

Covariance Matrix

Description

Computes the (centered) log-ratio covariance matrix (see below).

Usage

covariance(x, ...)

## S4 method for signature 'CompositionMatrix'
covariance(x, center = TRUE, method = "pearson")

## S4 method for signature 'ALR'
covariance(x, method = "pearson")

## S4 method for signature 'CLR'
covariance(x, method = "pearson")

Arguments

x

A CompositionMatrix object.

...

Currently not used.

center

A logical scalar: should the centered log-ratio covariance matrix be computed?

method

A character string indicating which covariance is to be computed (see stats::cov()).

Value

A matrix.

Methods (by class)

Author(s)

N. Frerebeau

References

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

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

See Also

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

Examples

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

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

## Log-ratio covariance matrix
## (Aitchison 1986, definition 4.5)
covariance(coda, center = FALSE)

## Centered log-ratio covariance matrix
## (Aitchison 1986, definition 4.6)
covariance(coda, center = TRUE)

[Package nexus version 0.2.0 Index]