View source: R/compositional_ops.R
| perturbation | R Documentation |
The perturbation operation combines two compositions by component-wise multiplication and then applies closure to ensure the result remains a valid composition.
perturbation(X, Y)
X |
A numeric vector, matrix or data.frame containing compositions. |
Y |
A numeric vector, matrix or data.frame with the same number of
parts as |
Perturbation is the analogue of addition in the simplex. Each part of
X is multiplied by the corresponding part of Y, and the result
is closed with closure so that each composition has constant
sum.
An object with the same format as X containing the perturbed
compositions, except that vector X with matrix or data.frame
Y returns the same rectangular format as Y.
x <- c(a = 1, b = 2, c = 3)
y <- c(a = 1, b = 1, c = 2)
perturbation(x, y)
X <- rbind(
c(1, 2, 3),
c(4, 5, 6)
)
perturbation(X, c(1, 1, 2))
perturbation(c(1, 1, 2), X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.