Nothing
alfa <- function(x, a, h = TRUE) {
## x contains the compositional data
## a is the power parameter, usually between -1 and 1
## if h is TRUE the multiplication with the Helmert matrix takes place
x <- as.matrix(x)
n <- dim(x)[1] ; D <- dim(x)[2] ; d <- D - 1
if ( D == 1 ) x <- t(x)
lx <- Rfast::Log(x)
if ( abs(a) > 1e-7 ) {
z <- x^a
ta <- Rfast::rowsums(z)
z <- D / a * z / ta - 1/a
sa <- n * d * log(D) + (a - 1) * sum(lx) - D * sum( log(ta) )
if ( h ) {
z <- tcrossprod(z, Compositional::helm(D) ) ## multiply by the Helmert sub-matrix
sa <- n * (d + 0.5) * log(D) + (a - 1) * sum(lx) - D * sum( log(ta) )
}
} else { ## if a = 0 the ilr is calculated
z <- lx - Rfast::rowmeans( lx ) ## this is the clr
sa <- - sum(lx) - n * log(D)
if ( h ) {
z <- tcrossprod(z, Compositional::helm(D) ) ## multiply by the Helmert sub-matrix
sa <- - sum(lx) - 0.5 * n * log(D)
}
}
list(sa = sa, aff = z)
}
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.