| Title: | 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>. |
| Authors: | Michail Tsagris [aut, cre], Christos Adam [aut] (ORCID: <https://orcid.org/0009-0003-3244-7034>) |
| Maintainer: | Michail Tsagris <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.0 |
| Built: | 2026-11-05 01:26:55 UTC |
| Source: | https://github.com/cran/Compositionalridge |
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>.
| Package: | Compositionalridge |
| Type: | Package |
| Version: | 1.0 |
| Date: | 2026-10-22 |
Michail Tsagris <[email protected]>.
Michail Tsagris [email protected]
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.
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)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)
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. |
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.
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. |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
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.
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)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)
-regression
K-fold cross-validation for the ridge -regression.
cv.aregridge(y, x, a = seq(0.1, by = 0.1), lambda = NULL, nlambda = 100, folds = NULL, nfolds = 10, seed = NULL)cv.aregridge(y, x, a = seq(0.1, by = 0.1), lambda = NULL, nlambda = 100, folds = NULL, nfolds = 10, seed = NULL)
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. |
K-fold cross-validation for the ridge -regression.
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. |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
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.
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)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)
-regression for compositional data
Ridge -regression for compositional data
areg.ridge(y, x, a, lambda = NULL, nlambda = 100, yb = NULL, xnew = NULL)areg.ridge(y, x, a, lambda = NULL, nlambda = 100, yb = NULL, 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 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. |
The ridge $-regression is applied.
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. |
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
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)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.
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)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)
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. |
Ridge regression using the Dirichlet regression, the zero adjuster Dirichlet regression, the Kullback-Leilber divergence regression or the multivariate zero inflated logistic normal regression.
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. |
Michail Tsagris and Christos Adam.
R implementation and documentation: Michail Tsagris [email protected] and the C++ part of zadr.ridge() by Christos Adam [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
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.
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)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)