| Title: | LASSO Compositional Data Regression |
|---|---|
| Description: | LASSO (Least Absolute Shrinkage and Selection Operator) regression for compositional responses with and without zero values present and continuous predictors. The choice of the penalty parameter, lambda, takes place using K-fold cross-validation. Two relevant papers are Li Z. et al. (2018) <doi:10.1007/s12561-018-9219-2> and Alenazi A.A. (2022) <doi:10.18187/pjsor.v18i4.3969>. |
| Authors: | Michail Tsagris [aut, cre] |
| Maintainer: | Michail Tsagris <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.0 |
| Built: | 2026-11-03 23:44:47 UTC |
| Source: | https://github.com/cran/CompositionalLASSO |
A multivariate zero inflated logistic normal regression model is implemented for compositional data with zero values present.
| Package: | CompositionalLASSO |
| Type: | Package |
| Version: | 1.0 |
| Date: | 2026-10-22 |
Michail Tsagris <[email protected]>.
Michail Tsagris [email protected]
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
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.
Alenazi A. A. (2022). f-divergence regression models for compositional data. Pakistan Journal of Statistics and Operation Research, 18(4): 867–882.
Cross-validation for the LASSO log-ratio regression with compositional response.
cv.lasso.compreg(y, x, lambda = NULL, nlambda = 100, nfolds = 10, folds = NULL, seed = NULL)cv.lasso.compreg(y, x, lambda = NULL, nlambda = 100, nfolds = 10, folds = NULL, seed = NULL)
y |
A numerical matrix with compositional data. Zero values are not allowed as the additive log-ratio transformation is applied to the compositional response prior to implementing the LASSO algortihm. |
x |
A matrix with the predictor variables. |
lambda |
A user supplied lambda sequence. |
nlambda |
This information is copied from the package glmnet. The number of |
nfolds |
The number of folds for the K-fold cross-validation, set to 10 by default. |
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. |
The K-fold cross-validation is performed in order to select the optimal value for , the
penalty parameter in LASSO.
A list including:
kld |
The cross-validated Kullback-Leibler divergence for each value of |
lambda.opt |
The optimal value of |
be |
The regression coefficients for the optimal value of |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
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.
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
lasso.compreg, lasso.klcompreg, cv.lasso.klcompreg
y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- cv.lasso.compreg(y, x)y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- cv.lasso.compreg(y, x)
Cross-validation for the LASSO Kullback-Leibler divergence based regression.
cv.lasso.klcompreg(y, x, lambda = NULL, nlambda = 100, type = "grouped", nfolds = 10, folds = NULL, seed = NULL)cv.lasso.klcompreg(y, x, lambda = NULL, nlambda = 100, type = "grouped", nfolds = 10, folds = NULL, seed = NULL)
y |
A numerical matrix with compositional data with or without zeros. |
x |
A matrix with the predictor variables. |
lambda |
A user supplied lambda sequence. |
nlambda |
This information is copied from the package glmnet. The number of |
type |
This information is copied from the package glmnet.. If "grouped" then a grouped lasso penalty is used on the multinomial coefficients for a variable. This ensures they are all in our out together. The default in our case is "grouped". |
nfolds |
The number of folds for the K-fold cross-validation, set to 10 by default. |
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. |
The K-fold cross-validation is performed in order to select the optimal value for ,
the penalty parameter in LASSO.
A list including:
kld |
The cross-validated Kullback-Leibler divergence for each value of |
lambda.opt |
The optimal value of |
be |
The regression coefficients for the optimal value of |
Michail Tsagris and Abdulaziz Alenazi.
R implementation and documentation: Michail Tsagris [email protected] and Abdulaziz Alenazi [email protected].
Alenazi, A. A. (2022). f-divergence regression models for compositional data. Pakistan Journal of Statistics and Operation Research, 18(4): 867–882.
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.
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
lasso.klcompreg, lasso.compreg, cv.lasso.compreg
y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- cv.lasso.klcompreg(y, x)y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- cv.lasso.klcompreg(y, x)
Cross-validation for the LASSO log-ratio regression with compositional response.
cv.lasso.mziln(y, x, lambda = NULL, nlambda = 100, nfolds = 10, folds = NULL, seed = NULL)cv.lasso.mziln(y, x, lambda = NULL, nlambda = 100, nfolds = 10, folds = NULL, seed = NULL)
y |
A numerical matrix with compositional data. Zero values are not allowed as the additive log-ratio transformation is applied to the compositional response prior to implementing the LASSO algortihm. |
x |
A matrix with the predictor variables. |
lambda |
A user supplied lambda sequence. |
nlambda |
This information is copied from the package glmnet. The number of |
nfolds |
The number of folds for the K-fold cross-validation, set to 10 by default. |
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. |
The K-fold cross-validation is performed in order to select the optimal value for , the
penalty parameter in LASSO.
A list including:
kld |
The cross-validated Kullback-Leibler divergence for each value of |
lambda.opt |
The optimal value of |
be |
The regression coefficients for the optimal value of |
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.
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.
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
lasso.compreg, lasso.klcompreg, lasso.mziln
y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) y[sample(150, 10), 3] <- 0 y <- y / rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- cv.lasso.mziln(y, x)y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) y[sample(150, 10), 3] <- 0 y <- y / rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- cv.lasso.mziln(y, x)
LASSO log-ratio regression.
lasso.compreg(y, x, lambda = NULL, nlambda = 100, xnew = NULL)lasso.compreg(y, x, lambda = NULL, nlambda = 100, xnew = NULL)
y |
A numerical matrix with compositional data. Zero values are not allowed as the additive log-ratio transformation is applied to the compositional response prior to implementing the LASSO algortihm. |
x |
A numerical matrix containing the predictor variables. |
lambda |
This information is copied from the package glmnet. A user supplied lambda sequence. Typical usage is to have the program compute its own lambda sequence based on nlambda and lambda.min.ratio. Supplying a value of lambda overrides this. WARNING: use with care. Avoid supplying a single value for lambda (for predictions after CV use predict() instead). Supply instead a decreasing sequence of lambda values. glmnet relies on its warms starts for speed, and its often faster to fit a whole path than compute a single fit. |
nlambda |
This information is copied from the package glmnet. The number of |
xnew |
If you have new data use it, otherwise leave it NULL. |
The function uses the glmnet package to perform LASSO penalised regression. For more details see the function in that package.
A list including:
be |
A list with the estimated regression coefficients for each value of |
info |
A matrix with two columns, the values of lambda used and their corresponding Kullback-Leibler divergence between the observed and the fitted values. |
est |
If you supply a matrix in the "xnew" argument this will return an array of many
matrices with the fitted values, where each matrix corresponds to each value of |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
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.
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
cv.lasso.compreg, lasso.klcompreg, cv.lasso.klcompreg,
lasso.mziln
y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- lasso.compreg(y, x)y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- lasso.compreg(y, x)
LASSO Kullback-Leibler divergence based regression.
lasso.klcompreg(y, x, lambda = NULL, nlambda = 100, type = "grouped", xnew = NULL)lasso.klcompreg(y, x, lambda = NULL, nlambda = 100, type = "grouped", xnew = NULL)
y |
A numerical matrix with compositional data. Zero values are allowed. |
x |
A numerical matrix containing the predictor variables. |
lambda |
This information is copied from the package glmnet. A user supplied lambda sequence. Typical usage is to have the program compute its own lambda sequence based on nlambda and lambda.min.ratio. Supplying a value of lambda overrides this. WARNING: use with care. Avoid supplying a single value for lambda (for predictions after CV use predict() instead). Supply instead a decreasing sequence of lambda values. glmnet relies on its warms starts for speed, and its often faster to fit a whole path than compute a single fit. |
nlambda |
This information is copied from the package glmnet. The number of |
type |
This information is copied from the package glmnet.. If "grouped" then a grouped lasso penalty is used on the multinomial coefficients for a variable. This ensures they are all in our out together. The default in our case is "grouped". |
xnew |
If you have new data use it, otherwise leave it NULL. |
The function uses the glmnet package to perform LASSO penalised regression. For more details see the function in that package.
A list including:
be |
A list with the estimated regression coefficients for each value of |
info |
A matrix with two columns, the values of lambda used and their corresponding Kullback-Leibler divergence between the observed and the fitted values. |
est |
If you supply a matrix in the "xnew" argument this will return an array of many matrices
with the fitted values, where each matrix corresponds to each value of |
Michail Tsagris and Abdulaziz Alenazi.
R implementation and documentation: Michail Tsagris [email protected] and Abdulaziz Alenazi [email protected].
Alenazi A. A. (2022). f-divergence regression models for compositional data. Pakistan Journal of Statistics and Operation Research, 18(4): 867–882.
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.
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
cv.lasso.klcompreg, lasso.compreg, lasso.mziln
y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- lasso.klcompreg(y, x)y <- as.matrix(iris[, 1:3]) y <- y/rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- lasso.klcompreg(y, x)
LASSO using the multivariate zero inflated logistic normal regression.
lasso.mziln(y, x, lambda = NULL, nlambda = 100, xnew = NULL)lasso.mziln(y, x, lambda = NULL, nlambda = 100, xnew = NULL)
y |
A numerical matrix with compositional data with zero values. |
x |
A numerical matrix containing the predictor variables. |
lambda |
This information is copied from the package glmnet. A user supplied lambda sequence. Typical usage is to have the program compute its own lambda sequence based on nlambda and lambda.min.ratio. Supplying a value of lambda overrides this. WARNING: use with care. Avoid supplying a single value for lambda (for predictions after CV use predict() instead). Supply instead a decreasing sequence of lambda values. glmnet relies on its warms starts for speed, and its often faster to fit a whole path than compute a single fit. |
nlambda |
This information is copied from the package glmnet. The number of |
xnew |
If you have new data use it, otherwise leave it NULL. |
The function uses the glmnet package to perform LASSO penalised regression.
A list including:
be |
A list with the estimated regression coefficients for each value of |
info |
A matrix with two columns, the values of lambda used and their corresponding Kullback-Leibler divergence between the observed and the fitted values. |
est |
If you supply a matrix in the "xnew" argument this will return an array of many
matrices with the fitted values, where each matrix corresponds to each value of |
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.
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.
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
cv.lasso.mziln, cv.lasso.compreg, cv.lasso.klcompreg
y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) y[sample(150, 10), 3] <- 0 y <- y / rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- lasso.mziln(y, x)y <- as.matrix(iris[, 1:3]) y <- y / rowSums(y) y[sample(150, 10), 3] <- 0 y <- y / rowSums(y) x <- matrix(rnorm(150 * 50), ncol = 50) mod <- lasso.mziln(y, x)