Learn R Programming

compositions (version 1.40-2)

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)
dnorm.aplus(x,mean,var)
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

Value

a random dataset of the given class generated by a normal distribution with the given mean and variance in the given space.

Details

The normal distributions in the variouse 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.

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.

The "acomp" and "aplus" are itself metric vector spaces and thus a normal distribution is defined in them just as in the real space. The resulting distribution corresponds to a multivariate lognormal in the case of "aplus" and in Aitchisons normal distribution in the simplex in the case of "acomp" (TO DO: Is that right??).

For the vector spaces rmult, aplus, acomp it is further possible to provide densities wiht repect to their Lebesgue measure. In the other cases this is not possible since the resulting distributions are not absolutly continues with respect to such a measure due to the truncation.

For count compositions ccomp a rnorm.acomp is realized and used as a parameter to a Poisson distribution (see rpois.ccomp).

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

See Also

runif.acomp, rlnorm.rplus, rDirichlet.acomp

Examples

Run this code
# 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)
# }

Run the code above in your browser using DataLab