Log-contrast regression with multiple compositional predictors {Compositional} | R Documentation |
Log-contrast regression with multiple compositional predictors
Description
Log-contrast regression with multiple compositional predictors.
Usage
lc.reg2(y, x, z = NULL, xnew = NULL, znew = NULL)
Arguments
y |
A numerical vector containing the response variable values. This must be a continuous variable. |
x |
A list with multiple matrices with the predictor variables, the compositional data. No zero values are allowed. |
z |
A matrix, data.frame, factor or a vector with some other covariate(s). |
xnew |
A matrix containing a list with multiple matrices with compositional data whose response is to be predicted. If you have no new data, leave this NULL as is by default. |
znew |
A matrix, data.frame, factor or a vector with the values of some other covariate(s). If you have no new data, leave this NULL as is by default. |
Details
The function performs the log-contrast regression model as described in Aitchison (2003), pg. 84-85.
The logarithm of the compositional predictor variables is used (hence no zero values are allowed).
The response variable is linked to the log-transformed data with the constraint that the sum of the
regression coefficients for each composition equals 0. Hence, we apply constrained least squares,
which has a closed form solution. The constrained least squares is described in Chapter 8.2 of Hansen (2019).
The idea is to minimise the sum of squares of the residuals under the constraint R^T \beta = c
,
where c=0
in our case. If you want the regression without the zum-to-zero contraints see
ulc.reg2
. Extra predictors variables are allowed as well, for instance categorical
or continuous. The difference with lc.reg
is that instead of one, there are multiple
compositions treated as predictor variables.
Value
A list including:
be |
The constrained regression coefficients. The sum of the sets of coefficients (excluding the constant) corresponding to each predictor composition sums to 0. |
covbe |
If covariance matrix of the constrained regression coefficients. |
va |
The variance of the estimated regression coefficients. |
residuals |
The vector of residuals. |
est |
If the arguments "xnew" and "znew" were given these are the predicted or estimated values, otherwise it is NULL. |
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
Hansen, B. E. (2022). Econometrics. Princeton University Press.
Xiaokang Liu, Xiaomei Cong, Gen Li, Kendra Maas and Kun Chen (2020). Multivariate Log-Contrast Regression with Sub-Compositional Predictors: Testing the Association Between Preterm Infants' Gut Microbiome and Neurobehavioral Outcome.
See Also
ulc.reg2, lc.reg, ulc.reg, lcreg.aov, alfa.pcr, alfa.knn.reg
Examples
y <- iris[, 1]
x <- list()
x1 <- as.matrix(iris[, 2:4])
x1 <- x1 / rowSums(x1)
x[[ 1 ]] <- x1
x[[ 2 ]] <- rdiri(150, runif(4) )
x[[ 3 ]] <- rdiri(150, runif(5) )
mod <- lc.reg2(y, x)
be <- mod$be
sum(be[2:4])
sum(be[5:8])
sum(be[9:13])