R/ait.R

Defines functions ait

Documented in ait

ait <- function(x, a, h = TRUE) {

  x <- as.matrix(x)
  D <- dim(x)[2]
  if (D == 1)  x <- t(x)
  D <- dim(x)[2] ## number of components

  if (a != 0) {
    z <- x^a
    z <- 1/a * z - Rfast::rowmeans(z) / a
  } else {
    z <- Rfast::Log(x)
    z <- z - Rfast::rowmeans(z)
  }

  if (h)  z <- tcrossprod(z, Compositional::helm(D))
  z
}

Try the Compositional package in your browser

Any scripts or data that you put into this service are public.

Compositional documentation built on Oct. 9, 2024, 5:10 p.m.