scls: Simplicial constrained linear least squares (SCLS) for...

View source: R/scls.R

The SCLS modelR Documentation

Simplicial constrained linear least squares (SCLS) for compositional responses and predictors

Description

Simplicial constrained linear least squares (SCLS) for compositional responses and predictors.

Usage

scls(y, x, xnew = NULL, nbcores = 4)

Arguments

y

A matrix with the compositional data (dependent variable). Zero values are allowed. It may also by a big matrix of the FBM class.

x

A matrix with the compositional predictors. Zero values are allowed. It may also by a big matrix of the FBM class.

xnew

If you have new data use it, otherwise leave it NULL.

nbcores

The number of cores to use in the case of an FBM class (big) matrix. If you do not know how many to cores to use, you may try the command nb_cores() from the bigparallelr package.

Details

The function performs least squares regression where the beta coefficients are constained to be positive and sum to 1. We were inspired by the transformation-free linear regression for compositional responses and predictors of Fiksel, Zeger and Datta (2022). Our implementation now uses quadratic programming instead of the function optim, and the solution is more accurate and extremely fast.

Big matrices, of FBM class, are now accepted.

Value

A list including:

mse

The mean squared error.

be

The beta coefficients.

est

The fitted of xnew if xnew is not NULL.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Tsagris. M. (2024). Constrained least squares simplicial-simplicial regression. https://arxiv.org/pdf/2403.19835.pdf

Fiksel J., Zeger S. and Datta A. (2022). A transformation-free linear regression for compositional outcomes and predictors. Biometrics, 78(3): 974–987.

See Also

cv.scls, tflr, scls.indeptest, scrq

Examples

library(MASS)
set.seed(1234)
y <- rdiri(214, runif(4, 1, 3))
x <- as.matrix(fgl[, 2:9])
x <- x / rowSums(x)
mod <- scls(y, x)
mod

Compositional documentation built on Oct. 9, 2024, 5:10 p.m.