Learn R Programming

Compositional (version 5.4)

Contour plot of the normal distribution in S^2: Contour plot of the normal distribution in \(S^2\)

Description

Contour plot of the normal distribution in \(S^2\).

Usage

norm.contour(m, s, type = "alr", n = 100, x = NULL, cont.line = FALSE)

Arguments

m

The mean vector.

s

The covariance matrix.

type

The type of trasformation used, either the additive log-ratio ("alr"), the isometric log-ratio ("ilr") or the pivot coordinate ("pivot") transformation.

n

The number of grid points to consider over which the density is calculated.

x

This is either NULL (no data) or contains a 3 column matrix with compositional data.

cont.line

Do you want the contour lines to appear? If yes, set this TRUE.

Value

A ternary diagram with the points (if appear = TRUE) and the bivariate normal contour lines.

Details

The alr or the ilr transformation is applied to the compositional data at first. Then for a grid of points within the 2-dimensional simplex the bivariate normal density is calculated and the contours are plotted along with the points.

See Also

diri.contour, mixnorm.contour, bivt.contour, skewnorm.contour

Examples

Run this code
# NOT RUN {
x <- as.matrix(iris[, 1:3])
x <- x / rowSums(x)
y <- Compositional::alr(x)
m <- colMeans(y)
s <- cov(y)
norm.contour(m, s)
# }

Run the code above in your browser using DataLab