| Title: | The alpha-Spatial Median Regression for Compositional Data |
|---|---|
| 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. |
| Authors: | Michail Tsagris [aut, cre] |
| Maintainer: | Michail Tsagris <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.0 |
| Built: | 2026-10-09 11:15:03 UTC |
| Source: | https://github.com/cran/Compositionalasmr |
The -spatial median regression is performed via the iteretively reweighted least
squares (IRLS) algorithm. At first the -transformation is applied and then the
non-linear regression model is fitted.
| Package: | Compositionalasmr |
| Type: | Package |
| Version: | 1.0 |
| Date: | 2026-08-20 |
Michail Tsagris <[email protected]>.
Michail Tsagris [email protected]
Aitchison J. (1986). The statistical analysis of compositional data.
-transformation
Spatial median regression with compositional data using the -transformation.
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)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)
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 |
yb |
If you have already transformed the data using the |
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. |
The -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.
A list including:
runtime |
The time required by the regression. |
iters |
The number of iterations required until convergence. |
norm |
The value of the |
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
.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Tsagris M. and Pantazis Y. (2026). The –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.
y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) x <- iris[, 4] mod <- asmr(y, x, 0.2)y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) x <- iris[, 4] mod <- asmr(y, x, 0.2)
-transformation
Regression with compositional data using the -transformation.
asmr.path(y, x, a = seq(-1, 1, by = 0.1), xnew = NULL, maxit = 100, tol = 1e-6, ncores = 1)asmr.path(y, x, a = seq(-1, 1, by = 0.1), xnew = NULL, maxit = 100, tol = 1e-6, ncores = 1)
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 |
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. |
The -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 .
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 |
covbe |
The covariance matrix if covb was set to TRUE, otherwise NULL. |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Tsagris M. and Pantazis Y. (2026). The –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.
y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) x <- iris[, 4] mod <- asmr.path(y, x, a = c(0.1, 0.2))y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) x <- iris[, 4] mod <- asmr.path(y, x, a = c(0.1, 0.2))
-smr
K-fold cross-validation for the -smr.
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)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)
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 |
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. |
Tuning the value of in the -smr takes place using
K-fold cross-validation.
A list including:
runtime |
The runtime required by the cross-validation. |
perf |
A vector with the average Kullback-Leibler divergence, for every value of |
opt |
A vector with the minimum Kullback-Leibler divergence and the optimal value of |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Tsagris M. and Pantazis Y. (2026). The –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
y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) x <- iris[, 4] mod <- cv.asmr(y, x, a = c(0.5, 1))y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) x <- iris[, 4] mod <- cv.asmr(y, x, a = c(0.5, 1))