Package {CompositionalMPT}


Type: Package
Title: Compositional Data Two-Sample Test of Equal Distributions
Version: 1.0
Date: 2026-08-20
Author: Michail Tsagris [aut, cre]
Maintainer: Michail Tsagris <mtsagris@uoc.gr>
Depends: R (≥ 4.0)
Imports: Compositional, Rfast, Rfast2
Description: Two-sample tests of equal distributions for compositional data, with zero values present. The p-value is computed via permutations. The relevant papers are Stewart C., Iverson S. and Field C. (2014). "Testing for a diet change using fatty acid signatures". Environmental and Ecological Statistics, <doi:10.1007/s10651-014-0280-9> and Sevinc V. and Tsagris. M. (2026). "Energy Based Equality of Distributions Testing for Compositional Data". Communications in Statistics–Simulation and Computation, <doi:10.1080/03610918.2026.2636167>.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
NeedsCompilation: no
Packaged: 2026-08-20 08:18:07 UTC; mtsag
Repository: CRAN
Date/Publication: 2026-08-24 10:10:27 UTC

Compositional Data Two-Sample Test of Equal Distributions

Description

Two-sample tests of equal distributions for compositional data, with zero values present. The p-value is computed via permutations.

Details

Package: CompositionalMPT
Type: Package
Version: 1.0
Date: 2026-08-20

Maintainers

Michail Tsagris <mtsagris@uoc.gr>.

Author(s)

Michail Tsagris mtsagris@uoc.gr

References

Stewart C., Iverson S. and Field C. (2014). Testing for a change in diet using fatty acid signatures. Environmental and Ecological Statistics, 21(4): 775–792.

Sevinc V. and Tsagris. M. (2026). Energy Based Equality of Distributions Testing for Compositional Data. Communications in Statistics-Simulation and Computation (Accepted for publication). https://arxiv.org/pdf/2412.05199


Energy test of equality of distributions using the \alpha-transformation

Description

Energy test of equality of distributions using the \alpha-transformation.

Usage

etest(x, y, a = 0.1, R = 999)

Arguments

x

A matrix with the compositional data of the first sample.

y

A matrix with the compositional data of the second sample.

a

The value of the power transformation, it has to be between -1 and 1. If zero values are present it has to be greater than 0. If \alpha=0 the isometric log-ratio transformation is applied. If more than one values are supplied the energy distance of equality of distributions is applied for each value of \alpha.

R

The number of permutations to apply in order to compute the approximate p-value.

Details

The \alpha-transformation is applied to each composition and then the energy distance of equality of distributions is applied.

Value

The permutation based p-value of the energy test.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Szekely, G. J. and Rizzo, M. L. (2004) Testing for Equal Distributions in High Dimension. InterStat, November (5).

Szekely, G. J. (2000) Technical Report 03-05: E-statistics: Energy of Statistical Samples. Department of Mathematics and Statistics, Bowling Green State University.

Tsagris M.T., Preston S. and Wood A.T.A. (2011). A data-based power transformation for compositional data. In Proceedings of the 4th Compositional Data Analysis Workshop, Girona, Spain. https://arxiv.org/pdf/1106.1451

Sevinc V. and Tsagris. M. (2026). Energy Based Equality of Distributions Testing for Compositional Data. Communications in Statistics-Simulation and Computation (Accepted for publication). https://arxiv.org/pdf/2412.05199

See Also

mpt

Examples

x <- matrix( rgamma(20 * 4, 3, 1), ncol = 4 )
x <- x / rowSums(x)  ## Dirichlet simulated values
y <- matrix( rgamma(30 * 4, 5, 1), ncol = 4 )
y <- y / rowSums(y)  ## Dirichlet simulated values
etest(x, y)

Multivariate permutation test of equality of distributions

Description

Multivariate permutation test of equality of distributions.

Usage

mpt(x, y, type = "ait", a = 0, R = 999)

Arguments

x

A matrix with the compositional data of the first sample.

y

A matrix with the compositional data of the second sample.

type

The type of distance to use, "ait", or "chisq". The first corresponds to Aitchison's distance, whereas the second refers to the chi-square distance.

a

The value of the power transformation, it has to be between -1 and 1. If zero values are present it has to be greater than 0. If \alpha=0 the isometric log-ratio transformation is applied. If more than one values are supplied the energy distance of equality of distributions is applied for each value of \alpha.

R

The number of permutations to apply in order to compute the approximate p-value.

Details

The multivariate permutation test of Stewart et al. (2014) is applied.

Value

A numerical value or a numerical vector, depending on the length of the values of \alpha, with the permutation based p-value(s) of the energy test.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Stewart C., Iverson S. and Field C. (2014). Testing for a change in diet using fatty acid signatures. Environmental and Ecological Statistics, 21(4): 775–792.

See Also

etest

Examples

x <- matrix( rgamma(20 * 4, 3, 1), ncol = 4 )
x <- x / rowSums(x)  ## Dirichlet simulated values
y <- matrix( rgamma(30 * 4, 5, 1), ncol = 4 )
y <- y / rowSums(y)  ## Dirichlet simulated values
mpt(x, y)