compositions (version 2.0-1)

# rnorm: Normal distributions on special spaces

## Description

`rnorm.`X generates multivariate normal random variates in the space X.

## Usage

```rnorm.acomp(n,mean,var)
rnorm.rcomp(n,mean,var)
rnorm.aplus(n,mean,var)
rnorm.rplus(n,mean,var)
rnorm.rmult(n,mean,var)
rnorm.ccomp(n,mean,var,lambda)
dnorm.acomp(x,mean,var,withJacobian=FALSE)
dnorm.aplus(x,mean,var,withJacobian=FALSE)
dnorm.rmult(x,mean,var)```

## Arguments

n

number of datasets to be simulated

mean

The mean of the dataset to be simulated

var

The variance covariance matrix

lambda

The expected total count

x

vectors in the sampling space

withJacobian

should the jacobian of the log or logratio transformation be included in the density calculations? defaults to FALSE (see details)

## Value

a random dataset of the given class generated by a normal distribution with the given mean and variance in the given space. For the density functions `d*`, the value of the probability density at the values of `x` provided

## Details

The normal distributions in the various spaces dramatically differ. The normal distribution in the `rmult` space is the commonly known multivariate joint normal distribution. For `rplus` this distribution has to be somehow truncated at 0. This is here done by setting negative values to 0, i.e. this simulation function produces a sort of multivariate tobit model.

The normal distribution of `rcomp` is seen as a normal distribution within the simplex as a geometrical portion of the real vector space. The variance is thus forced to be singular and restricted to the affine subspace generated by the simplex. The necessary truncation of negative values is currently done by setting them explicitly to zero and reclosing afterwards, again in the fashion of a tobit model.

The `"acomp"` and `"aplus"` are themselves metric vector spaces and thus a normal distribution is defined in them just as in the real space. The resulting distribution almost correspond to multivariate lognormal in the case of `"aplus"` and Aitchison normal distribution in the simplex in the case of `"acomp"`. These models are equivalent in probability to the multivariate lognormal distribution and the addditive logistic normal distribution respectively, albeit without including the jacobian of the log or the logratio transformation. If you are interested in the density of the additive logistic normal model, give the extra argument `withJacobian=TRUE`. If you are interested in the multivariate lognormal density cou can either do the same, or better call `dlnorm.rplus`.

Densities are only provided for the models constructed for `rmult`, `aplus` and `acomp` because they do exist w with repect to the Lebesgue measure of each of these spaces. In the other cases it is not possible to compute a measure, since the truncation at zero values produce distributions that are not absolutely continuous with respect to the real, conventional Lebesgue measure.

For count compositions `ccomp` a rnorm.acomp is realized and used as a parameter to a Poisson distribution (see `rpois.ccomp`). So, this is in reality no normal model, but a double stochastic counting process.

## References

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

Pawlowsky-Glahn, V. and J.J. Egozcue (2001) Geometric approach to statistical analysis on the simplex. SERRA 15(5), 384-398

Aitchison, J, C. Barcel'o-Vidal, J.J. Egozcue, V. Pawlowsky-Glahn (2002) A consise guide to the algebraic geometric structure of the simplex, the sample space for compositional data analysis, Terra Nostra, Schriften der Alfred Wegener-Stiftung, 03/2003

`runif.acomp`, `rlnorm.rplus`, `rDirichlet.acomp`

## Examples

```# NOT RUN {
MyVar <- matrix(c(
0.2,0.1,0.0,
0.1,0.2,0.0,
0.0,0.0,0.2),byrow=TRUE,nrow=3)
MyMean <- c(1,1,2)

plot(rnorm.acomp(100,MyMean,MyVar))
plot(rnorm.rcomp(100,MyMean,MyVar))
plot(rnorm.aplus(100,MyMean,MyVar))
plot(rnorm.rplus(100,MyMean,MyVar))
plot(rnorm.rmult(100,MyMean,MyVar))
x <- rnorm.aplus(5,MyMean,MyVar)
dnorm.acomp(x,MyMean,MyVar)
dnorm.aplus(x,MyMean,MyVar)
dnorm.rmult(x,MyMean,MyVar)
# }
```