powering: Powering of compositional data

View source: R/compositional_ops.R

poweringR Documentation

Powering of compositional data

Description

The powering operation raises each part of a composition to a scalar exponent and then applies closure to re-normalize the result as a composition.

Usage

powering(X, alpha)

Arguments

X

A numeric vector, matrix or data.frame containing compositions.

alpha

A numeric scalar or vector. If X is a matrix or data.frame, alpha may have length 1, length equal to the number of rows of X, or length equal to the number of parts of X. If X is a vector and alpha has length greater than 1, one powered composition is returned for each value of alpha.

Details

Powering is the analogue of scalar multiplication in the simplex. Each part is raised to alpha, and the result is closed with closure. When alpha has one value per row, each composition is powered by its corresponding value. When it has one value per part, each part receives its corresponding exponent. For vector X and vector alpha, each row of the result is X powered by the corresponding element of alpha.

Value

An object with the same format as X containing the powered compositions, except that vector X with vector alpha returns a matrix.

Examples

x <- c(a = 1, b = 2, c = 3)
powering(x, 2)
powering(x, c(1, 2))

X <- rbind(
  c(1, 2, 3),
  c(4, 5, 6)
)
powering(X, c(1, 2))


coda.base documentation built on May 8, 2026, 5:10 p.m.