scls2: The SCLS model with multiple compositional predictors

View source: R/scls2.R

The SCLS model with multiple compositional predictorsR Documentation

The SCLS model with multiple compositional predictors

Description

The SCLS model with multiple compositional predictors.

Usage

scls2(y, x, wei = FALSE, xnew = NULL)

Arguments

y

A matrix with the compositional data (dependent variable). Zero values are allowed.

x

A list of matrices with the compositional predictors. Zero values are allowed.

wei

Do you want weights among the different simplicial predictors? The default is FALSE.

xnew

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

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 (2020). Our implementation now uses quadratic programming instead of the function optim, and the solution is more accurate and extremely fast. This function allows for more than one simplicial predictors and offers the possibility of assigning weights to each simplicial predictor.

Value

A list including:

ini.mse

The mean squared error when all simplicial predictors carry equal weight.

ini.be

The beta coefficients when all simplicial predictors carry equal weight.

mse

The mean squared error when the simplicial predictors carry unequal weights.

weights

The weights in a vector form. A vector of length equal to the number of rows of the matrix of coefficients.

am

The vector of weights, one for each simplicia predictor. The length of the vector is equal to the number of simplicial predictors.

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

See Also

cv.scls, tflr, scls.indeptest

Examples

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

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