| Title: | Spatial Regression Models with Compositional Data |
|---|---|
| Description: | Spatial and non-spatial regression models with compositional responses (and compositional predictors) using the alpha--transformation. Relevant papers include: Tsagris M. and Pantazis Y. (2026), <doi:10.48550/arXiv.2510.12663>, Tsagris M. (2015), <https://soche.cl/chjs/volumes/06/02/Tsagris(2015).pdf>, Tsagris M.T., Preston S. and Wood A.T.A. (2011), <doi:10.48550/arXiv.1106.1451>. |
| Authors: | Michail Tsagris [aut, cre] |
| Maintainer: | Michail Tsagris <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.4 |
| Built: | 2026-05-14 09:25:18 UTC |
| Source: | https://github.com/cran/CompositionalSR |
Spatial regression models with compositional responses using the –transformation.
The models included are the -regression (not spatial), the -regression
(not spatial) with compositional predictors, the -spatially lagged X (-SLX) model,
the geographically weighted -regression (GWR) model and the -eigenvector
spatial filtering (-ESF) model.
| Package: | CompositionalSR |
| Type: | Package |
| Version: | 1.4 |
| Date: | 2026-04-14 |
| License: | GPL-2 |
Michail Tsagris <[email protected]>
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
Tsagris M., Papadovasilakis Z., Lakiotaki K. and Tsamardinos I. (2022).
The -OMP Algorithm for Feature Selection With Application to Gene Expression Data.
IEEE/ACM Transactions on Computational Biology and Bioinformatics, 19(2), 1214–1224.
-transformation
Compositional regression with compositional predictors using the -transformation.
alfa.pcreg(y, x, a, k, xnew = NULL, yb = NULL)alfa.pcreg(y, x, a, k, xnew = NULL, yb = NULL)
y |
A matrix with the compositional responses. Zero values are allowed. |
x |
A matrix with the compositional predictors. Zero values are allowed. |
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 |
k |
How many principal components to compute? |
xnew |
If you have new data use it, otherwise leave it NULL. |
yb |
If you have already transformed the data using the |
The -transformation is applied to both the compositional responses and predictors.
Then, principal component analysis is performed in the -transformed predictors and
the projected scores are used a predictors. The same value of is used for both the
responses and the predictors.
A list including:
runtime |
The time required by the regression. |
be |
The beta coefficients. |
dev |
The sum of the squared residuals, as produced by the function minpack.lm::nls.lm(). |
est |
The fitted values for xnew if xnew is not 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.
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8:11] x <- x / rowSums(x) mod <- alfa.pcreg(y, x, k = 3, 0.2)data(fadn) y <- fadn[, 3:7] x <- fadn[, 8:11] x <- x / rowSums(x) mod <- alfa.pcreg(y, x, k = 3, 0.2)
Computation of the contiguity matrix W.
contiguity(coords, k = 10)contiguity(coords, k = 10)
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
The number of nearest neighbours to consider for the contiguity matrix. |
The contiguity matrix W. A square matrix with row standardised values (the elements of each row sum to 1).
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
data(fadn) W <- contiguity(fadn[, 1:2])data(fadn) W <- contiguity(fadn[, 1:2])
A matrix with 11 columns. The first two are the locations (latitude and longitude), the next five contain the compositional data (percentages of cultivated area of five crops), Y1.1: cereals, Y2.1: cotton, Y3.1: tree crops, Y4.1: other annual crops and pasture and Y5.1: grapes and wine. The next four columns contain the covariates, G1: Human Influence Index, G2: soil pH, G3: topsoil organic carbon content and G7: erosion.
fadnfadn
A matrix with 168 rows and 11 columns.
Clark and Dixon (2021), available at https://github.com/nick3703/Chicago-Data.
Clark, N. J. and P. M. Dixon (2021). A class of spatially correlated self-exciting statistical models. Spatial Statistics, 43, 1–18.
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8:11] mod <- alfa.reg(y, x, a = 0.1)data(fadn) y <- fadn[, 3:7] x <- fadn[, 8:11] mod <- alfa.reg(y, x, a = 0.1)
-ESF model
ICE plot for the -ESF model.
ice.aesf(be, gama, x, X.esf, ind = 1, frac = 0.25, pos = 0.5)ice.aesf(be, gama, x, X.esf, ind = 1, frac = 0.25, pos = 0.5)
be |
A numerical matrix with the estimated |
gama |
A numerical matrix with the estimated |
x |
A numerical matrix with the predictor variables. |
X.esf |
A matrix with the values of the eigenvectors computed. |
ind |
Which variable to select?. |
frac |
Fraction of observations to use. The default value is 0.25. |
pos |
This is a number between 0 and 1 and is used to place the legend in the appropriate place. |
This function implements the Individual Conditional Expecation plots of Goldstein et al. (2015). See the references for more details.
A graph with several curves, one for each component. The horizontal axis contains the selected variable, whereas the vertical axis contains the locally smoothed predicted compositional lines.
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
https://christophm.github.io/interpretable-ml-book/ice.html
Goldstein, A., Kapelner, A., Bleich, J. and Pitkin, E. (2015). Peeking inside the black box: Visualizing statistical learning with plots of individual conditional expectation. Journal of Computational and Graphical Statistics 24(1): 44-65.
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8, drop = FALSE] mod <- alfa.esf(y, x, a = 0.1, coords = coords)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8, drop = FALSE] mod <- alfa.esf(y, x, a = 0.1, coords = coords)
-regression
ICE plot for the -regression.
ice.areg(be, x, ind = 1, frac = 0.25, pos = 0.5)ice.areg(be, x, ind = 1, frac = 0.25, pos = 0.5)
be |
A numerical matrix with the estimated |
x |
A numerical matrix with the predictor variables. |
ind |
Which variable to select?. |
frac |
Fraction of observations to use. The default value is 0.25. |
pos |
This is a number between 0 and 1 and is used to place the legend in the appropriate place. |
This function implements the Individual Conditional Expecation plots of Goldstein et al. (2015). See the references for more details.
A graph with several curves, one for each component. The horizontal axis contains the selected variable, whereas the vertical axis contains the locally smoothed predicted compositional lines.
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
https://christophm.github.io/interpretable-ml-book/ice.html
Goldstein, A., Kapelner, A., Bleich, J. and Pitkin, E. (2015). Peeking inside the black box: Visualizing statistical learning with plots of individual conditional expectation. Journal of Computational and Graphical Statistics 24(1): 44-65.
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8, drop = FALSE] mod <- alfa.reg(y, x, 0.2) ice <- ice.areg(mod$be, x, ind = 1)data(fadn) y <- fadn[, 3:7] x <- fadn[, 8, drop = FALSE] mod <- alfa.reg(y, x, 0.2) ice <- ice.areg(mod$be, x, ind = 1)
-regression
K-fold cross-validation for the -regression.
cv.alfareg(y, x, a = seq(0.1, 1, by = 0.1), nfolds = 10, folds = NULL, nc = 1, seed = NULL)cv.alfareg(y, x, a = seq(0.1, 1, by = 0.1), nfolds = 10, folds = NULL, nc = 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 |
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. |
nc |
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 -regression 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
alfa.reg, cv.alfaslx, cv.gwar, me.ar
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- cv.alfareg(y, x, a = c(0.5, 1))data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- cv.alfareg(y, x, a = c(0.5, 1))
-regression with compositional predictors
K-fold cross-validation the -regression with compositional predictors.
cv.alfapcreg(y, x, a = seq(0.1, 1, by = 0.1), k = dim(x)[2] - 2, nfolds = 10, folds = NULL, seed = NULL)cv.alfapcreg(y, x, a = seq(0.1, 1, by = 0.1), k = dim(x)[2] - 2, nfolds = 10, folds = NULL, seed = NULL)
y |
A matrix with compositional response data. Zero values are allowed. |
x |
A matrix with the compositional predictor variables. Zero values are allowed. |
a |
A numerical vector with the values 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 |
k |
A number with the maximum number of principal components to consider. Use at most the default value, dim(x)[2] - 2. |
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. |
seed |
You can specify your own seed number here or leave it NULL. |
Tuning the value of and k, the number of principal components in the
-regression with compositional predictors takes place using the
classical K-fold cross-validation.
A list including:
runtime |
The runtime required by the cross-validation. |
perf |
A matrix with the average Kullback-Leibler divergence, for every value of |
kl |
The minimum average value of the Kullback-Leibler divergence. |
opt_a |
The optimal value of |
opt_k |
The optimal value of k, the number of principal components. |
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
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8:11] x <- x / rowSums(x) mod <- cv.alfapcreg(y, x, a = c(0.5, 1))data(fadn) y <- fadn[, 3:7] x <- fadn[, 8:11] x <- x / rowSums(x) mod <- cv.alfapcreg(y, x, a = c(0.5, 1))
R model
Leave-one-out cross-validation for the GWR model
cv.gwar(y, x, a = c(0.1, 0.25, 0.5, 0.75, 1), coords, h, nfolds = 10, size = 1000, folds = NULL)cv.gwar(y, x, a = c(0.1, 0.25, 0.5, 0.75, 1), coords, h, nfolds = 10, size = 1000, folds = 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 |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
h |
A vector with bandwith values. |
nfolds |
The number of folds to split the data. |
size |
A numeric value of the specified range by which blocks are created and training/testing data are separated. This distance should be in metres. If you have big regions you should consider increasing this number. For more information see the package blockCV. |
folds |
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds. |
The 10-fold spatial cross-validation protocol is applied to choose the optimal values of and h.
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 divergance, 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
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- gwar(y, x, a = 1, coords, h = 0.001)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- gwar(y, x, a = 1, coords, h = 0.001)
-ESF model
Marginal effects for the -ESF model.
me.aesf(be, gama, mu, x, X.esf)me.aesf(be, gama, mu, x, X.esf)
be |
A matrix with the beta regression coefficients of the |
gama |
A matrix with the beta regression coefficients of the |
mu |
The fitted values of the |
x |
A matrix with the continuous predictor variables or a data frame. Categorical predictor variables are not suited here. |
X.esf |
A matrix with the eigenvectors. Categorical predictor variables are not suited here. |
The marginal effects of the -ESF model are computed.
A list including:
me |
An array with the marginal effects of each component for each predictor variable. |
ame |
The average marginal effects of each component for each predictor variable. |
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
data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8] mod <- alfa.esf(y, x, a = 0.1, coords = coords, xnew = x, coordsnew = coords) me <- me.aesf(mod$be, mod$gama, mod$est, x, mod$X.esf)data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8] mod <- alfa.esf(y, x, a = 0.1, coords = coords, xnew = x, coordsnew = coords) me <- me.aesf(mod$be, mod$gama, mod$est, x, mod$X.esf)
-regression model
Marginal effects for the -regression model.
me.ar(be, mu, x, cov_be = NULL)me.ar(be, mu, x, cov_be = NULL)
be |
A matrix with the beta regression coefficients of the |
mu |
The fitted values of the |
x |
A matrix with the continuous predictor variables or a data frame. Categorical predictor variables are not suited here. |
cov_be |
The covariance matrix of the beta regression coefficients. If you pass this argument, then the standard error of the average marginal effects will be returned. |
The marginal effects of the -regression model are computed.
A list including:
me |
An array with the marginal effects of each component for each predictor variable. |
ame |
The average marginal effects of each component for each predictor variable. |
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
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.reg(y, x, 0.2, xnew = x) me <- me.ar(mod$be, mod$est, x)data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.reg(y, x, 0.2, xnew = x) me <- me.ar(mod$be, mod$est, x)
-SAR model
Marginal effects for the -SAR model.
me.asar(be, rho, mu, x, coords, k, cov_theta = NULL)me.asar(be, rho, mu, x, coords, k, cov_theta = NULL)
be |
A matrix with the beta coefficients of the |
rho |
The spatial auto-regressive coefficient |
mu |
The fitted values of the |
x |
A matrix with the continuous predictor variables or a data frame. Categorical predictor variables are not suited here. |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
The number of nearest neighbours to consider for the contiguity matrix. |
cov_theta |
The covariance matrix of the beta and gamma regression coefficients. If you pass this argument, then the standard error of the average marginal effects will be returned. |
The marginal effects of the -SAR model are computed.
A list including:
me.dir |
An array with the direct marginal effects of each component for each predictor variable. |
me.indir |
An array with the indirect marginal effects of each component for each predictor variable. |
me.total |
An array with the total marginal effects of each component for each predictor variable. |
ame.dir |
An array with the average direct marginal effects of each component for each predictor variable. |
ame.indir |
An array with the average indirect marginal effects of each component for each predictor variable. |
ame.total |
An array with the aerage total marginal effects of each component for each predictor variable. |
se.amedir |
An array with the standard errors of the average direct marginal effects of each component for each predictor variable. This is returned if you supply the covariance matrix cov_theta. |
se.ameindir |
An array with the standard errors of the average indirect marginal effects of each component for each predictor variable. This is returned if you supply the covariance matrix cov_theta. |
se.ametotal |
An array with the standard errors of the average total marginal effects of each component for each predictor variable. This is returned if you supply the covariance matrix cov_theta. |
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
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.sar(y, x, a = 0.5, coords, k = 8) me <- me.asar(mod$be, mod$rho, mod$est, x, coords, k = 6)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.sar(y, x, a = 0.5, coords, k = 8) me <- me.asar(mod$be, mod$rho, mod$est, x, coords, k = 6)
-SLX model
Marginal effects for the -SLX model.
me.aslx(be, gama, mu, x, coords, k = 10, cov_theta = NULL)me.aslx(be, gama, mu, x, coords, k = 10, cov_theta = NULL)
be |
A matrix with the beta coefficients of the |
gama |
A matrix with the gamma coefficients of the |
mu |
The fitted values of the |
x |
A matrix with the continuous predictor variables or a data frame. Categorical predictor variables are not suited here. |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
The number of nearest neighbours to consider for the contiguity matrix. |
cov_theta |
The covariance matrix of the beta and gamma regression coefficients. If you pass this argument, then the standard error of the average marginal effects will be returned. |
The marginal effects of the -SLX model are computed.
A list including:
me.dir |
An array with the direct marginal effects of each component for each predictor variable. |
me.indir |
An array with the indirect marginal effects of each component for each predictor variable. |
me.total |
An array with the total marginal effects of each component for each predictor variable. |
ame.dir |
An array with the average direct marginal effects of each component for each predictor variable. |
ame.indir |
An array with the average indirect marginal effects of each component for each predictor variable. |
ame.total |
An array with the aerage total marginal effects of each component for each predictor variable. |
se.amedir |
An array with the standard errors of the average direct marginal effects of each component for each predictor variable. This is returned if you supply the covariance matrix cov_theta. |
se.ameindir |
An array with the standard errors of the average indirect marginal effects of each component for each predictor variable. This is returned if you supply the covariance matrix cov_theta. |
se.ametotal |
An array with the standard errors of the average total marginal effects of each component for each predictor variable. This is returned if you supply the covariance matrix cov_theta. |
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
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.slx(y, x, a = 0.5, coords, k = 10, xnew = x, coordsnew = coords) me <- me.aslx(mod$be, mod$gama, mod$est, x, coords, k = 10)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.slx(y, x, a = 0.5, coords, k = 10, xnew = x, coordsnew = coords) me <- me.aslx(mod$be, mod$gama, mod$est, x, coords, k = 10)
R model
Marginal effects for the GWR model.
me.gwar(be, mu, x)me.gwar(be, mu, x)
be |
A matrix with the beta regression coefficients of the |
mu |
The fitted values of the |
x |
A matrix with the continuous predictor variables or a data frame. Categorical predictor variables are not suited here. |
The location-specific marginal effects for the GWR model are computed.
A list including:
me |
An array with the location-specific marginal effects of each component for each predictor variable. |
ame |
The average location-specific marginal effects of each component for each predictor variable. |
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
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- gwar(y, x, a = 1, coords, h = 0.001) me <- me.gwar(mod$be, mod$est, x)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- gwar(y, x, a = 1, coords, h = 0.001) me <- me.gwar(mod$be, mod$est, x)
R model
Prediction with GWR model.
gwar.pred(y, x, a, coords, h, xnew, coordsnew)gwar.pred(y, x, a, coords, h, xnew, coordsnew)
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 values for the power transformation, it has to be between -1 and 1. |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
h |
A vector with bandwith values. |
xnew |
The new data. |
coordsnew |
A matrix with the coordinates of the new locations. The first column is the latitude and the second is the longitude. |
The -transformation is applied to the compositional data first and then the GWR model is applied and predictions are given for each observation.
A list including:
runtime |
The time required by the regression. |
est |
A list with the fitted values, for each combination 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
cv.gwar, me.gwar, alfa.slx, alfa.reg
data(fadn) coords <- fadn[-c(1:10), 1:2] y <- fadn[-c(1:10), 3:7] x <- fadn[-c(1:10), 8] xnew <- fadn[1:10, 8] coordsnew <- fadn[1:10, 1:2] mod <- gwar.pred(y, x, a = c(0.25, 0.5, 1), coords, h = c(0.002, 0.006), xnew = xnew, coordsnew = coordsnew)data(fadn) coords <- fadn[-c(1:10), 1:2] y <- fadn[-c(1:10), 3:7] x <- fadn[-c(1:10), 8] xnew <- fadn[1:10, 8] coordsnew <- fadn[1:10, 1:2] mod <- gwar.pred(y, x, a = c(0.25, 0.5, 1), coords, h = c(0.002, 0.006), xnew = xnew, coordsnew = coordsnew)
-transformation
Regression with compositional data using the -transformation.
areg(y, x, a, covb = FALSE, xnew = NULL, yb = NULL) alfa.reg(y, x, a, covb = FALSE, xnew = NULL, yb = NULL) alfa.reg2(y, x, a, xnew = NULL, ncores = 1) alfa.reg3(y, x, a = c(-1, 1), xnew = NULL)areg(y, x, a, covb = FALSE, xnew = NULL, yb = NULL) alfa.reg(y, x, a, covb = FALSE, xnew = NULL, yb = NULL) alfa.reg2(y, x, a, xnew = NULL, ncores = 1) alfa.reg3(y, x, a = c(-1, 1), xnew = NULL)
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 The function areg() is faster as it passes the Jacobian matrix to the nls.lm() function. |
covb |
Do you want the covariance matrix of the regression coefficients to be returned? If TRUE, this will slow down the process, as it is computed numerically. |
xnew |
If you have new data use it, otherwise leave it NULL. |
ncores |
The number of cores to use for parallel computations. |
yb |
If you have already transformed the data using the This is intended to be used in the function |
The -transformation is applied to the compositional data first and then multivariate
regression is applied. This involves numerical optimisation. The alfa.reg2() function accepts a
vector with many values of , while the the alfa.reg3() function searches for the
value of that minimizes the Kulback-Leibler divergence between the observed and
the fitted compositional values. The functions are highly optimized.
For the alfa.reg() function a list including:
runtime |
The time required by the regression. |
be |
The beta coefficients. |
covbe |
The covariance matrix if covb was set to TRUE, otherwise NULL. |
dev |
The sum of the squared residuals, as produced by the function minpack.lm::nls.lm(). |
est |
The fitted values for xnew if xnew is not NULL. |
For the alfa.reg2() function a list with the time required by all regressions and the regression coefficients and the fitted values for each value of .
For the alfa.reg3() function a list with the previous elements plus an output "alfa", 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.
cv.alfareg, alfareg.nr, alfa.slx
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.reg(y, x, 0.2)data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.reg(y, x, 0.2)
-transformation
Regression with compositional data using the -transformation.
rob.alfareg(y, x, a, loss = "welsh", xnew = NULL, yb = NULL)rob.alfareg(y, x, a, loss = "welsh", xnew = NULL, yb = NULL)
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 |
loss |
The loss function to use. One of these available options, "barron", "bisquare", "welsh", "optimal", "hampel", "ggw", or "lqq". For more information see the package gslnls. |
xnew |
If you have new data use it, otherwise leave it NULL. |
yb |
If you have already transformed the data using the |
The -transformation is applied to the compositional data first and then robust multivariate regression is applied. This involves numerical optimisation.
A list including:
runtime |
The time required by the regression. |
be |
The beta coefficients. |
est |
The fitted values for xnew if xnew is not 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.
alfa.reg, alfareg.nr, alfa.slx
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- rob.alfareg(y, x, 0.2)data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- rob.alfareg(y, x, 0.2)
-ESF model
Spatial K-fold cross-validation for the -ESF model
cv.alfaesf(y, x, a = seq(0.1, 1, by = 0.1), coords, model = "exp", nfolds = 10, size = 1000, folds = NULL)cv.alfaesf(y, x, a = seq(0.1, 1, by = 0.1), coords, model = "exp", nfolds = 10, size = 1000, folds = 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 |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
model |
Type of kernel to model spatial dependence. The currently available options are "exp" for the exponential kernel, "gau" for the Gaussian kernel, and "sph" for the spherical kernel. For more information check the package "spmoran". |
nfolds |
The number of folds to split the data. |
size |
A numeric value of the specified range by which blocks are created and training/testing data are separated. This distance should be in metres. If you have big regions you should consider increasing this number. For more information see the package blockCV. |
folds |
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds. |
The 10-fold spatial cross-validation protocol is applied to choose the optimal values of
and k.
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, spatially-lagged, spatial autoregressive and geographically-weighted regression models.
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
Tsagris M., Papadovasilakis Z., Lakiotaki K. and Tsamardinos I. (2022).
The -OMP Algorithm for Feature Selection With Application to Gene Expression Data.
IEEE/ACM Transactions on Computational Biology and Bioinformatics, 19(2), 1214–1224.
data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- cv.alfaesf(y, x, a = c(0.1, 0.5), coords, nfolds = 5)data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- cv.alfaesf(y, x, a = c(0.1, 0.5), coords, nfolds = 5)
-SAR model
Spatial K-fold cross-validation for the -SAR model
cv.alfasar(y, x, a = seq(0.1, 1, by = 0.1), coords, k = 2:15, nfolds = 10, size = 1000, folds = NULL)cv.alfasar(y, x, a = seq(0.1, 1, by = 0.1), coords, k = 2:15, nfolds = 10, size = 1000, folds = 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 |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
A vector with the nearest neighbours to consider for the contiguity matrix. |
nfolds |
The number of folds to split the data. |
size |
A numeric value of the specified range by which blocks are created and training/testing data are separated. This distance should be in metres. If you have big regions you should consider increasing this number. For more information see the package blockCV. |
folds |
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds. |
The 10-fold spatial cross-validation protocol is applied to choose the optimal values of and k.
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, 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
data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8]data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8]
-SLX model
Spatial K-fold cross-validation for the -SLX model
cv.alfaslx(y, x, a = seq(0.1, 1, by = 0.1), coords, k = 2:15, nfolds = 10, size = 1000, folds = NULL)cv.alfaslx(y, x, a = seq(0.1, 1, by = 0.1), coords, k = 2:15, nfolds = 10, size = 1000, folds = 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 |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
A vector with the nearest neighbours to consider for the contiguity matrix. |
nfolds |
The number of folds to split the data. |
size |
A numeric value of the specified range by which blocks are created and training/testing data are separated. This distance should be in metres. If you have big regions you should consider increasing this number. For more information see the package blockCV. |
folds |
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds. |
The 10-fold spatial cross-validation protocol is applied to choose the optimal values of and k.
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, 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
data(fadn) coords <- fadn[1:60, 1:2] y <- fadn[1:60, 3:7] x <- fadn[1:60, 8] mod <- cv.alfaslx(y, x, a = 0.5, coords, k = 2)data(fadn) coords <- fadn[1:60, 1:2] y <- fadn[1:60, 3:7] x <- fadn[1:60, 8] mod <- cv.alfaslx(y, x, a = 0.5, coords, k = 2)
Spatial k-folds.
spat.folds(coords, nfolds = 10, size = 1000)spat.folds(coords, nfolds = 10, size = 1000)
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
nfolds |
The number of spatial folds to create. |
size |
A numeric value of the specified range by which blocks are created and training/testing data are separated. This distance should be in metres. If you have big regions you should consider increasing this number. For more information see the package blockCV. |
Folds of data are created based on their coordinates. For more information see the package blockCV.
A list with nfolds elements. Each elements contains a list with two elements, the first is the indices of the training set and the second contains the indices of the test set.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
cv.alfaslx, me.aslx, gwar, alfa.reg
data(fadn) coords <- fadn[1:100, 1:2] folds <- spat.folds(coords, nfolds = 5)data(fadn) coords <- fadn[1:100, 1:2] folds <- spat.folds(coords, nfolds = 5)
-ESF model
The -ESF model.
alfa.esf(y, x, a, coords, model = "exp", xnew = NULL, coordsnew, yb = NULL)alfa.esf(y, x, a, coords, model = "exp", xnew = NULL, coordsnew, yb = NULL)
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 |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
model |
Type of kernel to model spatial dependence. The currently available options are "exp" for the exponential kernel, "gau" for the Gaussian kernel, and "sph" for the spherical kernel. For more information check the package "spmoran". |
xnew |
If you have new data use it, otherwise leave it NULL. |
coordsnew |
A matrix with the coordinates of the new locations. The first column is the latitude and the second is the longitude. If you do not have new data to make predictions leave this NULL. |
yb |
If you have already transformed the data using the |
The -transformation is applied to the compositional data first. Then the eigenvectors of the
kernelized distance matrix are computed and the appropriate number is selected to be included as
predictors. The selection takes place using the -OMP algorithm (Tsagris et al., 2022).
A list including:
runtime |
The time required by the regression. |
be |
The beta coefficients. |
gama |
The gamma coefficients of the eigenvectors. |
ESF |
A vector with the indices of the eigenvectors used. |
X.esf |
A matrix with the values of the eigenvectors used. |
dev |
The sum of the squared residuals, as produced by the function minpack.lm::nls.lm(). |
est |
The fitted values for xnew if xnew and coordsnew are not 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
Tsagris M., Papadovasilakis Z., Lakiotaki K. and Tsamardinos I. (2022).
The -OMP Algorithm for Feature Selection With Application to Gene Expression Data.
IEEE/ACM Transactions on Computational Biology and Bioinformatics, 19(2), 1214–1224.
cv.alfaesf, alfa.sar, alfa.slx, alfa.reg
data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8] mod <- alfa.esf(y, x, a = 0.1, coords = coords)data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8] mod <- alfa.esf(y, x, a = 0.1, coords = coords)
-regression using Newton-Raphson
The -regression using Newton-Raphson.
alfareg.nr(y, x, alpha = 1, beta_init = NULL, max_iter = 100, tol = 1e-6, line_search = TRUE, hess.eps = 1e-5)alfareg.nr(y, x, alpha = 1, beta_init = NULL, max_iter = 100, tol = 1e-6, line_search = TRUE, hess.eps = 1e-5)
y |
A matrix with the compositional data. |
x |
A matrix with the continuous predictor variables or a data frame including categorical predictor variables. |
alpha |
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. |
beta_init |
A vector of initial parameters (optional). This is then transformed into a matrix. |
max_iter |
The maximum number of iterations for the Newton-Raphson algorithm. |
tol |
The tolerance value to terminate the Newton-Raphson algorithm. |
line_search |
Do you want to perform line search? The default value is TRUE. |
hess.eps |
This is the infinitesimal change to compute the Hessian matrix numerically. |
The -transformation is applied to the compositional data first and then multivariate regression is applied. This involves numerical optimisation.
A list including:
runtime |
The time required by the regression. |
iters |
The iterations of the Newton-Raphson algorithm |
be |
The beta coefficients. |
objective |
The sum of the squared residuals. |
est |
The predicted values if xnew is not NULL. |
covb |
The covariance matrix of the beta coefficients, or NULL if it is singular. |
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.
alfa.reg, cv.alfareg, alfa.slx
data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfareg.nr(y, x, a = 0.2) mod2 <- alfa.reg(y, x, 0.2)data(fadn) y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfareg.nr(y, x, a = 0.2) mod2 <- alfa.reg(y, x, 0.2)
-SAR model
The -SAR model.
alfa.sar(y, x, a, coords, k = 10, covb = FALSE, xnew = NULL, coordsnew, yb = NULL)alfa.sar(y, x, a, coords, k = 10, covb = FALSE, xnew = NULL, coordsnew, yb = NULL)
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 |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
The number of nearest neighbours to consider for the contiguity matrix. |
covb |
Do you want the covariance matrix of the spatial autoregressive parameter and the regression coefficients to be returned? If TRUE, this will slow down the process, as it is computed numerically. |
xnew |
If you have new data use it, otherwise leave it NULL. |
coordsnew |
A matrix with the coordinates of the new locations. The first column is the latitude and the second is the longitude. If you do not have new data to make predictions leave this NULL. |
yb |
If you have already transformed the data using the |
The -transformation is applied to the compositional data first and the spatial autocorrelation (SAR) model is applied. The function performs a grid search searching for the range
of good values of and then uses that as starting value.
A list including:
runtime |
The time required by the regression. |
be |
The beta coefficients. |
covbe |
The covariance matrix if covb was set to TRUE, otherwise NULL. |
dev |
The sum of the squared residuals, as produced by the function minpack.lm::nls.lm(). |
est |
The fitted values for xnew if xnew and coordsnew are not 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
cv.alfaslx, me.aslx, gwar, alfa.reg
data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8]data(fadn) coords <- fadn[1:50, 1:2] y <- fadn[1:50, 3:7] x <- fadn[1:50, 8]
-SLX model
The -SLX model.
alfa.slx(y, x, a, coords, k = 10, covb = FALSE, xnew = NULL, coordsnew, yb = NULL) alfa.slx2(y, x, a, coords, k = 2:15, xnew = NULL, coordsnew, yb = NULL)alfa.slx(y, x, a, coords, k = 10, covb = FALSE, xnew = NULL, coordsnew, yb = NULL) alfa.slx2(y, x, a, coords, k = 2:15, xnew = NULL, coordsnew, yb = NULL)
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 |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
The number of nearest neighbours to consider for the contiguity matrix. For the alfa.slx2() this should be a vector. |
covb |
Do you want the covariance matrix of the regression coefficients to be returned? If TRUE, this will slow down the process, as it is computed numerically. |
xnew |
If you have new data use it, otherwise leave it NULL. |
coordsnew |
A matrix with the coordinates of the new locations. The first column is the latitude and the second is the longitude. If you do not have new data to make predictions leave this NULL. |
yb |
If you have already transformed the data using the This is intended to be used in the function |
The -transformation is applied to the compositional data first and then the spatially lagged X (SLX) model is applied.
For the alfa.slx() a list including:
runtime |
The time required by the regression. |
be |
The beta coefficients. |
gama |
The gamma coefficients. |
covbe |
The covariance matrix if covb was set to TRUE, otherwise NULL. |
dev |
The sum of the squared residuals, as produced by the function minpack.lm::nls.lm(). |
est |
The fitted values for xnew if xnew and coordsnew are not NULL. |
For the alfa.slx2() a list including:
runtime |
The time required by the regression. |
be |
A list with the beta coefficients for each value of k. |
gama |
A list with the gamma coefficients. |
dev |
A vector with the sum of the squared residuals, as produced by the function minpack.lm::nls.lm(). The positions of the vector are the ones defined by the argument k that is a vector. |
est |
A list with the fitted values for the xnew and coordsnew, for each value of k. |
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
cv.alfaslx, me.aslx, gwar, alfa.reg
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.slx(y, x, a = 0.5, coords, k = 10)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.slx(y, x, a = 0.5, coords, k = 10)
-regression model at each observation
The gradient vector of the -regression model at each observation.
ar.grads(y, x, a, be)ar.grads(y, x, a, be)
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. |
be |
The regression coefficients of the |
The gradient vector of the -regression model is computed at each observation.
A matrix with the gradient vector computed at each observation.
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
alfa.sar, cv.alfasar, alfa.reg
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8:10] mod <- alfa.reg(y, x, 0.5) grads <- ar.grads(y, x, a = 0.5, mod$be) colSums(grads)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8:10] mod <- alfa.reg(y, x, 0.5) grads <- ar.grads(y, x, a = 0.5, mod$be) colSums(grads)
-SAR model at each observation
The gradient vector of the -SAR model at each observation.
asar.grads(y, x, a, rho, be, coords, k)asar.grads(y, x, a, rho, be, coords, k)
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. |
rho |
The spatial autocorrelation parameter |
be |
The regression coefficients of the |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
The number of nearest neighbours to consider for the contiguity matrix. |
The gradient vector of the -SAR model is computed at each observation.
A matrix with the gradient vector computed at each observation.
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
alfa.sar, cv.alfasar, alfa.reg
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8:10] be <- matrix( c( 12.72191991, 0.04300266, -1.78301001, -3.02074120, -23.54785921, 0.06771573, 2.71969599, 1.89312564, 5.38640736, 0.05179626, -1.21336879, 0.40175088, -1.98258721, 0.06815682, -0.64458883, 0.95470802 ), ncol = 4 )data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8:10] be <- matrix( c( 12.72191991, 0.04300266, -1.78301001, -3.02074120, -23.54785921, 0.06771573, 2.71969599, 1.89312564, 5.38640736, 0.05179626, -1.21336879, 0.40175088, -1.98258721, 0.06815682, -0.64458883, 0.95470802 ), ncol = 4 )
-SLX model at each observation
The gradient vector of the -SLX model at each observation.
aslx.grads(y, x, a, be, gama, coords, k = 10)aslx.grads(y, x, a, be, gama, coords, k = 10)
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. |
be |
The regression coefficients of the |
gama |
The gamma coefficients of the |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
k |
The number of nearest neighbours to consider for the contiguity matrix. |
The gradient vector of the -SLX model is computed at each observation.
A matrix with the gradient vector computed at each observation.
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
alfa.sar, cv.alfasar, alfa.reg
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.slx(y, x, a = 0.5, coords, k = 10) grads <- aslx.grads(y, x, a = 0.5, mod$be, mod$gama, coords, k = 10) colSums(grads)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- alfa.slx(y, x, a = 0.5, coords, k = 10) grads <- aslx.grads(y, x, a = 0.5, mod$be, mod$gama, coords, k = 10) colSums(grads)
R model
The GWR model.
gwar(y, x, a, coords, h, yb = NULL, nc = 1)gwar(y, x, a, coords, h, yb = NULL, nc = 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 |
The value of the power transformation, it has to be between -1 and 1. |
coords |
A matrix with the coordinates of the locations. The first column is the latitude and the second is the longitude. |
h |
The bandwith value. |
yb |
If you have already transformed the data using the |
nc |
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. |
The -transformation is applied to the compositional data first and then the GWR model is applied.
A list including:
runtime |
The time required by the regression. |
be |
The beta coefficients. |
est |
The fitted values. |
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
cv.gwar, me.gwar, alfa.slx, alfa.reg
data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- gwar(y, x, a = 1, coords, h = 0.001)data(fadn) coords <- fadn[, 1:2] y <- fadn[, 3:7] x <- fadn[, 8] mod <- gwar(y, x, a = 1, coords, h = 0.001)