# ternary: Ternary diagram In Compositional: Compositional Data Analysis

Ternary diagram.

## Usage

 `1` ```ternary(x, means = TRUE, pca = FALSE) ```

## Arguments

 `x` A matrix with the compositional data. `means` A boolean variable. Should the closed geometric mean and the arithmetic mean appear (TRUE) or not (FALSE)?. `pca` Should the first PCA calculated Aitchison (1983) described appear? If yes, then this should be TRUE, or FALSE otherwise.

## Details

The first PCA is calcualte using the centred log-ratio transformation as Aitchison (1983, 1986) suggested. If the data contain zero values, the first PCA will not be plotted. There are two ways to create a ternary graph. The one I used here, where eqch edge is equal to 1 and the one Aitchison (1986) uses. For every given point, the sum of the distances from the edges is equal to 1. Zeros in the data appear with green circles in the triangle and you will also see NaN in the closed geometric mean.

## Value

The ternary plot and a matrix with the closed geometric and the simple arithmetic mean vector.

## Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <[email protected]> and Giorgos Athineou <[email protected]>

## References

Aitchison, J. (1983). Principal component analysis of compositional data. Biometrika 70(1):57-65.

Aitchison J. (1986). The statistical analysis of compositional data. Chapman \& Hall.

```comp.den, alfa, diri.contour, comp.kerncontour ```

## Examples

 ```1 2 3 4 5``` ```library(MASS) x <- as.matrix(fgl[, 2:4]) ternary(x, means = FALSE) x <- as.matrix(iris[, 1:3]) ternary(x, pca = TRUE) ```

### Example output

```                       Na       Mg       Al
closed geometric      NaN      NaN      NaN
arithmetic mean  13.40785 2.684533 1.444907
Sepal.Length Sepal.Width Petal.Length
closed geometric    0.4801195   0.2511578    0.2687228
arithmetic mean     5.8433333   3.0573333    3.7580000
```

Compositional documentation built on Jan. 13, 2019, 5:04 p.m.