dAitchison(x,
theta=alpha+sigma %*% clr(mu),
beta=-1/2*gsi.svdinverse(sigma),
alpha=mean(theta),
mu=clrInv(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(sigma%*%(theta-alpha)),
sigma=-1/2*gsi.svdinverse(beta))
AitchisonDistributionIntegrals(
theta=alpha+sigma %*% clr(mu),
beta=-1/2*gsi.svdinverse(sigma),
alpha=mean(theta),
mu=clrInv(sigma%*%(theta-alpha)),
sigma=-1/2*gsi.svdinverse(beta),
grid=30,
mode=3)
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.runif.acomp
, rnorm.acomp
,
rDirichlet.acomp
(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