Package {Compositionalzerocens}


Type: Package
Title: Modelling Zero Values in Compositional Data Using a Censored Model
Version: 1.0
Date: 2026-08-03
Author: Michail Tsagris [aut, cre]
Maintainer: Michail Tsagris <mtsagris@uoc.gr>
Depends: R (≥ 4.0)
Imports: Compositional, far, Rfast, stats
Suggests: Rfast2
Description: Modelling structural zeros in compositional data assuming a latent Gaussian model, where MLE is performed via the EM algorithm. The relevant paper is Tsagris M. (2026). Modelling structural zeros in compositional data via a zero-censored multivariate normal model. <doi:10.48550/arXiv.2208.13073>.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
NeedsCompilation: no
Packaged: 2026-08-03 06:08:09 UTC; mtsag
Repository: CRAN
Date/Publication: 2026-08-08 12:30:28 UTC

Modelling Zero Values in Compositional Data Using a Censored Model

Description

Modelling Zero Values in Compositional Data Using a Censored Model.

Details

Package: Compositionalzerocens
Type: Package
Version: 1.0
Date: 2026-08-03

Maintainers

Michail Tsagris <mtsagris@uoc.gr>.

Author(s)

Michail Tsagris mtsagris@uoc.gr

References

Tsagris M. (2026). Modelling structural zeros in compositional data via a zero-censored multivariate normal model.

https://arxiv.org/pdf/2208.13073


Maximum likelihood estimation of the zero-censored model

Description

Maximum likelihood estimation of the zero-censored model.

Usage

rzerocens(n, mu, sigma)

Arguments

n

The sample size.

mu

The mean vector in R^{D-1}.

sigma

The covariance matrix in R^{D-1}.

Details

The function generates compositional data from the cero-censored model (Tsagris, 2026). The drawback is that only 1 zero, at most, is allowed in each compositional vector.

Value

A numerical matrix with compositional data.

Author(s)

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

References

Tsagris M. (2026). Modelling structural zeros in compositional data via a zero-censored multivariate normal model.

https://arxiv.org/pdf/2208.13073

Examples

mu <- c(0.325, 0.121)
sigma <- matrix(c(0.149, -0.200,
                  -0.200,  0.323), 2, 2)
x <- rzerocens(1000, mu, sigma)

Maximum likelihood estimation of the zero-censored model

Description

Maximum likelihood estimation of the zero-censored model.

Usage

zerocens.em(x, tol = 1e-6, maxit = 1000)
zerocens.mle(x)

Arguments

x

A numerical matrix with compositional data. Only one zero value is allowed in each row.

tol

The tolerance value to terminate the EM algorithm.

maxit

The maximum number of iterations allowed for the EM algorithm.

Details

The function fits the cero-censored model (Tsagris, 2026) to compositional data with zero values. The drawback is that only 1 zero, at most, is allowed in each compositional vector. The zerocens.em() function fits the model using the EM algorithm and it is quite efficient, whereas the second function, zerocens.mle() uses optim() and is quite slow.

Value

A list including:

loglik

The log-likelihood value.

iters

The number of iterations required by the EM algorithm.

mu

The estimated mean vector.

sigma

The estimated covariance matrix.

Author(s)

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

References

Tsagris M. (2026). Modelling structural zeros in compositional data via a zero-censored multivariate normal model.

https://arxiv.org/pdf/2208.13073

Examples

mu <- c(0.325, 0.121)
sigma <- matrix(c(0.149, -0.200,
                  -0.200,  0.323), 2, 2)
x <- rzerocens(100, mu, sigma)
zerocens.em(x)
zerocens.mle(x)