Package {Compositionalasmr}


Type: Package
Title: The alpha-Spatial Median Regression for Compositional Data
Version: 1.0
Date: 2026-08-20
Author: Michail Tsagris [aut, cre]
Maintainer: Michail Tsagris <mtsagris@uoc.gr>
Depends: R (≥ 4.0)
Imports: Compositional, minpack.lm, parallel, rangen, Rfast, stats
Suggests: Rfast2
Description: The alpha-spatial median regression is performed via the iteretively reweighted least squares algorithm. At first the alpha-transformation of Tsagris, Preston and Wood (2011) <doi:10.48550/arXiv.1106.1451> is applied and then the non-linear regression model is fitted.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
NeedsCompilation: no
Packaged: 2026-08-20 09:12:36 UTC; mtsag
Repository: CRAN
Date/Publication: 2026-09-03 12:20:27 UTC

The alpha-Spatial Median Regression for Compositional Data

Description

The alpha-spatial median regression is performed via the iteretively reweighted least squares (IRLS) algorithm. At first the alpha-transformation is applied and then the non-linear regression model is fitted.

Details

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

Maintainers

Michail Tsagris <mtsagris@uoc.gr>.

Author(s)

Michail Tsagris mtsagris@uoc.gr

References

Aitchison J. (1986). The statistical analysis of compositional data.


Spatial median regression with compositional data using the \alpha-transformation

Description

Spatial median regression with compositional data using the \alpha-transformation.

Usage

asmr(y, x, a, yb = NULL, xnew = NULL, maxit = 100, tol = 1e-06 )
asmr2(y, x, a = c(-1, 1), xnew = NULL, maxit = 500, tol = 1e-6)

Arguments

y

A matrix with the compositional data.

x

A matrix with the continuous predictor variables or a data frame including categorical predictor variables.

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 and the solution exists in a closed form, since it the classical mutivariate regression. For the asmr2() this is a vector with the lower and upper value of \alpha to search for.

yb

If you have already transformed the data using the \alpha-transformation with the same \alpha as given in the argument "a", put it here. Othewrise leave it NULL.

xnew

If you have new data use it, otherwise leave it NULL.

maxit

The maximum number of iterations the IRLS algorithm will perform.

tol

The tolerance value to terminate the IRLS algorithm.

Details

The \alpha-transformation is applied to the compositional data first and then non-linear spatial median regression using the iteratively reqeighted least squares (IRLS) algorithm is performed.

Value

A list including:

runtime

The time required by the regression.

iters

The number of iterations required until convergence.

norm

The value of the L_1 norm.

be

The beta coefficients.

est

The fitted values for xnew if xnew is not NULL.

The asmr2() function also returns an extra outcome, the "alpha", which is the optimal value of \alpha.

Author(s)

Michail Tsagris.

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

References

Tsagris M. and Pantazis Y. (2026). The \alpha–regression for compositional data: a unified framework for standard, temporal and spatial regression models including compositional predictors. https://arxiv.org/pdf/2510.12663

Tsagris M. (2015). Regression analysis with compositional data containing zero values. Chilean Journal of Statistics, 6(2): 47-57. https://arxiv.org/pdf/1508.01913v1.pdf

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.pdf

Mardia K.V., Kent J.T., and Bibby J.M. (1979). Multivariate analysis. Academic press.

Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.

See Also

cv.asmr, asmr.path

Examples

y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
x <- iris[, 4]
mod <- asmr(y, x, 0.2)

Regression with compositional data using the \alpha-transformation

Description

Regression with compositional data using the \alpha-transformation.

Usage

asmr.path(y, x, a = seq(-1, 1, by = 0.1), xnew = NULL, maxit = 100,
tol = 1e-6, ncores = 1)

Arguments

y

A matrix with the compositional data.

x

A matrix with the continuous predictor variables or a data frame including categorical predictor variables.

a

A vector with the \alpha values of the power transformation, it has to be between -1 and 1.

xnew

If you have new data use it, otherwise leave it NULL.

maxit

The maximum number of iterations the IRLS algorithm will perform.

tol

The tolerance value to terminate the IRLS algorithm.

ncores

The number of cores to use for parallel computations.

Details

The \alpha-transformation is applied to the compositional data first and then non-linear spatial median regression using the iteratively reqeighted least squares (IRLS) algorithm is performed. This takes place for each value of \alpha.

Value

For the alfa.reg() function a list including:

runtime

The time required by the regression.

res

A list with two components: "be", the estimated regression coefficients, and "est", the fitted values, both for each value of \alpha.

covbe

The covariance matrix if covb was set to TRUE, otherwise NULL.

Author(s)

Michail Tsagris.

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

References

Tsagris M. and Pantazis Y. (2026). The \alpha–regression for compositional data: a unified framework for standard, temporal and spatial regression models including compositional predictors. https://arxiv.org/pdf/2510.12663

Tsagris M. (2015). Regression analysis with compositional data containing zero values. Chilean Journal of Statistics, 6(2): 47-57. https://arxiv.org/pdf/1508.01913v1.pdf

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.pdf

Mardia K.V., Kent J.T., and Bibby J.M. (1979). Multivariate analysis. Academic press.

Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.

See Also

asmr, cv.asmr

Examples

y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
x <- iris[, 4]
mod <- asmr.path(y, x, a = c(0.1, 0.2))

K-fold cross-validation for the \alpha-smr

Description

K-fold cross-validation for the \alpha-smr.

Usage

cv.asmr(y, x, a = seq(0.1, 1, by = 0.1), maxit = 500, tol = 1e-6,
nfolds = 10, folds = NULL, ncores = 1, seed = NULL)

Arguments

y

A matrix with compositional data. zero values are allowed.

x

A matrix with the continuous predictor variables or a data frame including categorical predictor variables.

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.

maxit

The maximum number of iterations the IRLS algorithm will perform.

tol

The tolerance value to terminate the IRLS algorithm.

nfolds

The number of folds to split the data.

folds

If you have the list with the folds supply it here. You can also leave it NULL and it will create folds.

ncores

The number of cores to use. IF you have a multicore computer it is advisable to use more than 1. It makes the procedure faster. It is advisable to use it if you have many observations and or many variables, otherwise it will slow down th process.

seed

You can specify your own seed number here or leave it NULL.

Details

Tuning the value of \alpha in the \alpha-smr takes place using K-fold cross-validation.

Value

A list including:

runtime

The runtime required by the cross-validation.

perf

A vector with the average Kullback-Leibler divergence, for every value of \alpha.

opt

A vector with the minimum Kullback-Leibler divergence and the optimal value of \alpha.

Author(s)

Michail Tsagris.

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

References

Tsagris M. and Pantazis Y. (2026). The \alpha–regression for compositional data: a unified framework for standard, temporal and spatial regression models including compositional predictors. https://arxiv.org/pdf/2510.12663

Tsagris M. (2015). Regression analysis with compositional data containing zero values. Chilean Journal of Statistics, 6(2): 47-57. https://arxiv.org/pdf/1508.01913v1.pdf

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.pdf

See Also

asmr, asmr.path

Examples

y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
x <- iris[, 4]
mod <- cv.asmr(y, x, a = c(0.5, 1))