The Aitchison distribution is a class of distributions the simplex, containing the normal and the Dirichlet as subfamilies.
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)
acomp-compositions the density should be computed for.
integer: number of datasets to be simulated
numeric vector: Location parameter vector
matrix: Spread parameter matrix (clr or ilr)
positiv scalar: departure from normality parameter (positive scalar)
acomp-composition, normal reference mean parameter composition
matrix: normal reference variance matrix (clr or ilr)
integer: number of discretisation points along each side of the simplex
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.
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
The closing divisor of the density
Should a pre-spliting of the Aitchison density be used for simulation?
Returns the density of the Aitchison distribution evaluated at x as a numeric vector.
Returns a sample of size n of simulated compostions as an acomp object.
Returns a list with
thetathe theta parameter given or computed
betathe beta parameter given or computed
alphathe alpha parameter given or computed
muthe mu parameter given or computed
sigmathe sigma parameter given or computed
expKappathe integral over the density without closing constant. I.e. the inverse of the closing constant and the exp of \(\kappa_{Ait(\theta,\beta)}\)
kappaIntegralThe expected value of the mean of the logs of the components as numerically computed
clrMeanThe mean of the clr transformed random variable, computed numerically
clrSqExpectationThe expectation of \(clr(X)clr(X)^t\) computed numerically.
clrVarThe variance covariance matrix of clr(X), computed numerically
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.
Aitchison, J. (1986) The Statistical Analysis of Compositional Data Monographs on Statistics and Applied Probability. Chapman & Hall Ltd., London (UK). 416p.
# NOT RUN {
(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)
# }
Run the code above in your browser using DataLab