Last chance! 50% off unlimited learning
Sale ends in
Computes the (centered) log-ratio covariance matrix (see below).
covariance(x, ...)# S4 method for CompositionMatrix
covariance(x, center = TRUE, method = "pearson")
# S4 method for ALR
covariance(x, method = "pearson")
# S4 method for CLR
covariance(x, method = "pearson")
A matrix
.
A CompositionMatrix
object.
Currently not used.
A logical
scalar: should the centered log-ratio
covariance matrix be computed?
A character
string indicating which covariance is to be
computed (see stats::cov()
).
covariance(ALR)
: Computes the log-ratio covariance matrix
(Aitchison 1986, definition 4.5).
covariance(CLR)
: Computes the centered log-ratio covariance matrix
(Aitchison 1986, definition 4.6).
N. Frerebeau
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.
## 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)
Run the code above in your browser using DataLab