Nothing
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(coda.base)
nP = 6 nO = 8 set.seed(1) X = matrix(rlnorm(nP * nO), ncol = nP, nrow = nO) colnames(X) = paste0('P', 1:nP) rownames(X) = paste0('O', 1:nO) X
center(X)
variation_array(X)
stats::dist()
is rewritten to include the Aitchison distance between compositions:
dist(X, method = 'aitchison')
coordinates()
coordinates(X)
By default, coda.base
uses the isometric log-ratio coordinates defined in Egozcue et al. 2003.
coordinates(X, 'ilr')
: isometric log-ratio coordinates (Egozcue et al. 2003, defaults)coordinates(X, 'olr')
: orthonormal log-ratio coordinates (equivalent to ilr
)coordinates(X, 'alr')
: additive log-ratio coordinatescoordinates(X, 'clr')
: centered log-ratio coordinatescoordinates(X, 'pw')
: pairwise log-ratio coordinatescoordinates(X, 'pc')
: principal component coordinatescoordinates(X, 'pb')
: principal balance coordinatescoordinates(X, 'cdp')
: balanced isometric log-ratio coordinatesTo reduce typing, alr_c()
, clr_c()
, ilr_c()
and olr_c()
are functions that call coordinates()
function with the option given by their name.
coordinates(X, B)
accepts a log-contrast matrix $B$ to build the log-ratio coordinates. Different log-contrast matrices $B$ can be constructed (following section).
ilr_basis(nP)
all.equal(as.numeric(coordinates(X, 'ilr')), as.numeric(log(X) %*% ilr_basis(nP)))
Log-ratio matrix transformations:
ilr_basis(nP)
or olr_basis(nP)
(Egozcue et al. 2003, defaults)ilr_basis(nP, type = 'pivot')
or olr_basis(nP, type = 'pivot')
to pivot log-ratio coordinatesilr_basis(nP, type = 'cdp')
or olr_basis(nP, type = 'cdp')
to balanced log-ratio coordinates (CoDaPack's default)alr_basis(nP)
to additive-log ratio coordinates. Numerator order and denominator can be modified. For example, alr_basis(nP, denominator = 1, numerator = nP:2)
.clr_basis(nP)
to centered log-ratio coordinates.pc_basis(X)
to principal components log-ratio coordinates.cc_basis(X, X2)
to canonical correlations log-ratio coordinates.pb_basis(X, method = 'exact')
to principal balances using the exact algorithm.pb_basis(X, method = 'constrained')
to principal balances using pca constrained algorithm.pb_basis(X, method = 'cluster')
to principal balances obtained using parts clustering algorithm.pairwise_basis(nP)
to pairwise log-ratio coordinates.sbp_basis(b0 = b1~b2, b1 = P1~P2+P3, b2 = P4~P5+P6, data=X)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.