raitchison: Aitchison Distribution

rAitchisonR Documentation

Aitchison Distribution

Description

The Aitchison distribution is a class of distributions the simplex, containing the normal and the Dirichlet as subfamilies.

Usage

dAitchison(x,
           theta=alpha+sigma %*% clr(mu),
           beta=-1/2*gsi.svdinverse(sigma),
           alpha=mean(theta),
           mu=clrInv(c(sigma%*%(theta-alpha))),
           sigma=-1/2*gsi.svdinverse(beta),
           grid=30,
           realdensity=FALSE,
           expKappa=AitchisonDistributionIntegrals(theta,beta,
                        grid=grid,mode=1)$expKappa)
rAitchison(n,
           theta=alpha+sigma %*% clr(mu),
           beta=-1/2*gsi.svdinverse(sigma),
           alpha=mean(theta),
           mu=clrInv(c(sigma%*%(theta-alpha))),
           sigma=-1/2*gsi.svdinverse(beta), withfit=FALSE)
AitchisonDistributionIntegrals(
           theta=alpha+sigma %*% clr(mu),
           beta=-1/2*gsi.svdinverse(sigma),
           alpha=mean(theta),
           mu=clrInv(c(sigma%*%(theta-alpha))),
           sigma=-1/2*gsi.svdinverse(beta),
           grid=30,
           mode=3)

Arguments

x

acomp-compositions the density should be computed for.

n

integer: number of datasets to be simulated

theta

numeric vector: Location parameter vector

beta

matrix: Spread parameter matrix (clr or ilr)

alpha

positiv scalar: departure from normality parameter (positive scalar)

mu

acomp-composition, normal reference mean parameter composition

sigma

matrix: normal reference variance matrix (clr or ilr)

grid

integer: number of discretisation points along each side of the simplex

realdensity

logical: if true the density is given with respect to the Haar measure of the real simplex, if false the density is given with respect to the Aitchison measure of the simplex.

mode

integer: desired output: -1: Compute nothing, only transform parameters,
0: Compute only oneIntegral and kappaIntegral,
1: compute also the clrMean,
2: compute also the clrSqExpectation,
3: same as 2, but compute clrVar instead of clrSqExpectation

expKappa

The closing divisor of the density

withfit

Should a pre-spliting of the Aitchison density be used for simulation?

Details

The Aitchison Distribution is a joint generalisation of the Dirichlet Distribution and the additive log-normal distribution (or normal on the simplex). It can be parametrized by Ait(theta,beta) or by Ait(alpha,mu,Sigma). Actually, beta and Sigma can be easily transformed into each other, such that only one of them is necessary. Parameter theta is a vector in R^D, alpha is its sum, mu is a composition in S^D, and beta and sigma are symmetric matrices, which can either be expressed in ilr or clr space. The parameters are transformed as

\beta=-1/2 \Sigma^{-1}

\theta=clr(\mu)\Sigma+\alpha (1,\ldots,1)^t

The distribution exists, if either, \alpha\geq 0 and Sigma is positive definite (or beta negative definite) in ilr-coordinates, or if each theta is strictly positive and Sigma has at least one positive eigenvalue (or beta has at least one negative eigenvalue). The simulation procedure currently only works with the first case.
AitchisonDistributionIntegral is a convenience function to compute the parameter transformation and several functions of these parameters. This is done by numerical integration over a multinomial simplex lattice of D parts with grid many elements (see xsimplex).
The density of the Aitchison distribution is given by:

f(x,\theta,\beta)=exp((\theta-1)^t \log(x)+ilr(x)^t \beta ilr(x))/exp(\kappa_{Ait(\theta,\beta)})

with respect to the classical Haar measure on the simplex, and as

f(x,\theta,\beta)=exp(\theta^t \log(x)+ilr(x)^t \beta ilr(x))/exp(\kappa_{Ait(\theta,\beta)})

with respect to the Aitchison measure of the simplex. The closure constant expKappa is computed numerically, in AitchisonDistributionIntegrals.

The random composition generation is done by rejection sampling based on an optimally fitted additive logistic normal distribution. Thus, it only works if the correponding Sigma in ilr would be positive definite.

Value

dAitchison

Returns the density of the Aitchison distribution evaluated at x as a numeric vector.

rAitchison

Returns a sample of size n of simulated compostions as an acomp object.

AitchisondistributionIntegrals

Returns a list with

theta

the theta parameter given or computed

beta

the beta parameter given or computed

alpha

the alpha parameter given or computed

mu

the mu parameter given or computed

sigma

the sigma parameter given or computed

expKappa

the integral over the density without closing constant. I.e. the inverse of the closing constant and the exp of \kappa_{Ait(\theta,\beta)}

kappaIntegral

The expected value of the mean of the logs of the components as numerically computed

clrMean

The mean of the clr transformed random variable, computed numerically

clrSqExpectation

The expectation of clr(X)clr(X)^t computed numerically.

clrVar

The variance covariance matrix of clr(X), computed numerically

Note

The simulation procedure currently only works with a positive definite Sigma. You need a relatively high grid constant for precise values in the numerical integration.

Author(s)

K.Gerald v.d. Boogaart, R. Tolosana-Delgado http://www.stat.boogaart.de

References

Aitchison, J. (1986) The Statistical Analysis of Compositional Data Monographs on Statistics and Applied Probability. Chapman & Hall Ltd., London (UK). 416p.

See Also

runif.acomp, rnorm.acomp, rDirichlet.acomp

Examples

(erg<-AitchisonDistributionIntegrals(c(-1,3,-2),ilrvar2clr(-diag(c(1,2))),grid=20))

(myvar<-with(erg, -1/2*ilrvar2clr(solve(clrvar2ilr(beta)))))
(mymean<-with(erg,myvar%*%theta))

with(erg,myvar-clrVar)
with(erg,mymean-clrMean)


compositions documentation built on June 22, 2024, 12:15 p.m.