| Type: | Package |
| Title: | Ridge Regression for Compositional Data |
| Version: | 1.0 |
| Date: | 2026-10-22 |
| Maintainer: | Michail Tsagris <mtsagris@uoc.gr> |
| Depends: | R (≥ 4.0) |
| Imports: | Compositional, glmnet, minpack.lm, Rfast, stats, Rcpp |
| Suggests: | Rfast2 |
| Description: | A few ridge regression models for compositional data with zero values present. These are the zero adjusted Dirichlet regression, the multivariate zero inflated logistic normal, the Kullback-Leibler divergence and the alpha-regression. Some relevant papers include Tsagris and Stewart (2018) <doi:10.1134/S1995080218030198>, Tsagris et al. (2026) <doi:10.48550/arXiv.2510.12663>, and Li et al. (2018) <doi:10.1007/s12561-018-9219-2>. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| LinkingTo: | Rcpp, RcppArmadillo |
| Encoding: | UTF-8 |
| Config/roxygen2/version: | 8.1.1 |
| NeedsCompilation: | yes |
| Packaged: | 2026-10-22 12:01:13 UTC; mtsag |
| Author: | Michail Tsagris [aut, cre],
Christos Adam |
| Repository: | CRAN |
| Date/Publication: | 2026-11-04 20:10:08 UTC |
Ridge Regression for Compositional Data
Description
A few ridge regression models for compositional data with zero values present. These are the zero adjusted Dirichlet regression, the multivariate zero inflated logistic normal, the Kullback-Leibler divergence and the alpha-regression. Some relevant papers include Tsagris and Stewart (2018) <doi:10.1134/S1995080218030198>, Tsagris et al. (2026) <doi:10.48550/arXiv.2510.12663>, and Li et al. (2018) <doi:10.1007/s12561-018-9219-2>.
Details
| Package: | Compositionalridge |
| Type: | Package |
| Version: | 1.0 |
| Date: | 2026-10-22 |
Maintainers
Michail Tsagris <mtsagris@uoc.gr>.
Author(s)
Michail Tsagris mtsagris@uoc.gr
References
Li Z., Lee K., Karagas M. R., Madan J. C., Hoen A. G., O'Malley A. J. and Li H. (2018). Conditional regression based on a multivariate zero-inflated logistic-normal model for microbiome relative abundance data. Statistics in Biosciences, 10(3): 587–608.
Cross-validation for ridge regression for compositional data
Description
Cross-validation for ridge regression for compositional data.
Usage
cv.zadrridge(y, x, lambda = NULL, nlambda = 100, tol = 1e-06, maxit = 100,
folds = NULL, nfolds = 10, seed = NULL)
cv.drridge(y, x, lambda = NULL, nlambda = 100, tol = 1e-06, maxit = 100,
folds = NULL, nfolds = 10, seed = NULL)
cv.kldridge(y, x, lambda = NULL, nlambda = 100,
folds = NULL, nfolds = 10, seed = NULL)
cv.mzilnridge(y, x, lambda = NULL, nlambda = 100,
folds = NULL, nfolds = 10, seed = NULL)
Arguments
y |
A matrix with the compositional data (dependent variable). Only for the Dirichlet regression, zeros are not allowed. |
x |
The predictor variable(s), they can only be continnuous variables. |
lambda |
A vector with a sequence of the ridge |
nlambda |
The number of |
tol |
The tolerance value to terminate the Fisher scoring algorithm. |
maxit |
The maximum number of iterations the Fisher scoring algorithm will perform. |
folds |
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds. |
nfolds |
The number of folds to produce. |
seed |
You can specify your own seed number here or leave it NULL. |
Details
K-fold cross-validation for the ridge regression using the Dirichlet regression, the zero adjuster Dirichlet regression, the Kullback-Leilber divergence regression or the multivariate zero inflated logistic normal regression.
Value
A list including:
runtime |
The runtime of the ridge regression model. |
info |
A matrix with two or three columns containing the lambda, the penalized log-likelihood (for dr and zadr), and the Kullback-Leibler divergence between the observed and te fitted compositions. |
be |
A list with the ridge beta coefficients. |
est |
A list with the ridge estimated compositions. |
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Li Z., Lee K., Karagas M. R., Madan J. C., Hoen A. G., O'Malley A. J. and Li H. (2018). Conditional regression based on a multivariate zero-inflated logistic-normal model for microbiome relative abundance data. Statistics in Biosciences, 10(3): 587–608.
See Also
Examples
x <- matrix( rnorm(150 * 10), ncol = 10 )
y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
ind <- sample(150, 10)
for ( k in ind ) y[k, sample(3, 1)] <- 0
y <- y / rowSums(y)
mod <- kld.ridge(y, x)
K-fold cross-validation for the ridge \alpha-regression
Description
K-fold cross-validation for the ridge \alpha-regression.
Usage
cv.aregridge(y, x, a = seq(0.1, by = 0.1), lambda = NULL, nlambda = 100,
folds = NULL, nfolds = 10, seed = NULL)
Arguments
y |
A matrix with the compositional data (dependent variable). Only for the Dirichlet regression, zeros are not allowed. |
x |
The predictor variable(s), they can only be continnuous variables. |
a |
A vector with values of |
lambda |
A vector with a sequence of the ridge |
nlambda |
The number of |
folds |
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds. |
nfolds |
The number of folds to produce. |
seed |
You can specify your own seed number here or leave it NULL. |
Details
K-fold cross-validation for the ridge \alpha-regression.
Value
A list including:
runtime |
The runtime of the ridge regression model. |
info |
A matrix with two columns containing the lambda, the penalized log-likelihood (for dr and zadr), and the Kullback-Leibler divergence between the observed and te fitted compositions. |
be |
A list with the ridge beta coefficients. |
sest |
A list with the ridge estimated compositions. |
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Li Z., Lee K., Karagas M. R., Madan J. C., Hoen A. G., O'Malley A. J. and Li H. (2018). Conditional regression based on a multivariate zero-inflated logistic-normal model for microbiome relative abundance data. Statistics in Biosciences, 10(3): 587–608.
See Also
Examples
x <- matrix( rnorm(150 * 10), ncol = 10 )
y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
ind <- sample(150, 10)
for ( k in ind ) y[k, sample(3, 1)] <- 0
y <- y / rowSums(y)
mod <- kld.ridge(y, x)
Ridge \alpha-regression for compositional data
Description
Ridge \alpha-regression for compositional data
Usage
areg.ridge(y, x, a, lambda = NULL, nlambda = 100, yb = NULL, xnew = NULL)
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 values of |
lambda |
A vector with a sequence of the ridge |
nlambda |
The number of |
yb |
If you have already |
xnew |
If you have new data whose response values you want to compute, pass them here. |
Details
The ridge $\alpha-regression is applied.
Value
A list including:
runtime |
The runtime of the ridge |
info |
A matrix with two columns containing the lambda, and the Kullback-Leibler divergence between the observed and the fitted compositions. |
be |
A list with the ridge beta coefficients. Note: The predictors are standardised internally and then ridge regression is applied. The returned coefficients are transformed back to their original scale, just like the package glmnet does. |
est |
A list with the ridge estimated compositions, if xnew is not 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
See Also
Examples
x <- matrix( rnorm(150 * 10), ncol = 10 )
y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
ind <- sample(150, 10)
for ( k in ind ) y[k, sample(3, 1)] <- 0
y <- y / rowSums(y)
mod <- areg.ridge(y, x, 0.5)
Ridge regression for compositional data
Description
Ridge regression for compositional data.
Usage
zadr.ridge(y, x, lambda = NULL, nlambda = 100, xnew = NULL, tol = 1e-6, maxit = 100)
dr.ridge(y, x, lambda = NULL, nlambda = 100, xnew = NULL, tol = 1e-6, maxit = 100)
kld.ridge(y, x, lambda = NULL, nlambda = 100, xnew = NULL)
mziln.ridge(y, x, lambda = NULL, nlambda = 100, xnew = NULL)
Arguments
y |
A matrix with the compositional data (dependent variable). Only for the Dirichlet regression, zeros are not allowed. |
x |
The predictor variable(s), they can only be continnuous variables. |
lambda |
A vector with a sequence of the ridge |
nlambda |
The number of |
xnew |
If you have new data whose response values you want to compute, pass them here. |
tol |
The tolerance value to terminate the Fisher scoring algorithm. |
maxit |
The maximum number of iterations the Fisher scoring algorithm will perform. |
Details
Ridge regression using the Dirichlet regression, the zero adjuster Dirichlet regression, the Kullback-Leilber divergence regression or the multivariate zero inflated logistic normal regression.
Value
A list including:
runtime |
The runtime of the ridge regression model. |
info |
A matrix with two or three columns containing the lambda, the penalized log-likelihood (for dr and zadr), and the Kullback-Leibler divergence between the observed and the fitted compositions. |
be |
A list with the ridge beta coefficients. Note that for the mziln.ridge() the additive log-ratio transformation is implied as well, but the reference category is the last component, unlike all other regression models that imply the first component. So, be careful with the interpretation. Also, for the kld.ridge() the coefficients are based on the inverse of the centered log-ratio transformation. Note: For all regression models, the predictors are standardised internally and then ridge regression is applied. The returned coefficients are transformed back to their original scale, just like the package glmnet does. |
est |
A list with the ridge estimated compositions, if xnew is not NULL. |
Author(s)
Michail Tsagris and Christos Adam.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr and the C++ part of zadr.ridge() by Christos Adam pada4m4@gmail.com.
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
Alenazi A. A. (2022). f-divergence regression models for compositional data. Pakistan Journal of Statistics and Operation Research, 18(4): 867–882.
Tsagris M. and Stewart C. (2018). A Dirichlet regression model for compositional data with zeros. Lobachevskii Journal of Mathematics,39(3): 398–412.
Li Z., Lee K., Karagas M. R., Madan J. C., Hoen A. G., O'Malley A. J. and Li H. (2018). Conditional regression based on a multivariate zero-inflated logistic-normal model for microbiome relative abundance data. Statistics in Biosciences, 10(3): 587–608.
Friedman J., Hastie T. and Tibshirani R. (2010) Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of Statistical Software, Vol. 33(1), 1–22.
See Also
Examples
x <- matrix( rnorm(150 * 10), ncol = 10 )
y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
ind <- sample(150, 10)
for ( k in ind ) y[k, sample(3, 1)] <- 0
y <- y / rowSums(y)
mod <- kld.ridge(y, x)