Learn R Programming

Compositional (version 1.1)

comp.reg: Regression with compositional data

Description

Regression with compositional data.

Usage

comp.reg(y, x, type = "classical", xnew = NULL)

Arguments

y
A matrix with the compsitional data. Zero values are not allowed.
x
The predictor variable(s), they have to be continuous.
type
The type of regression to be used, "classical" for standard multivariate regression, "spatial" for spatial median regression, which is also robust.
xnew
This is by default set to NULL. If you have new data whose compositional data values you want to predict, put them here.

Value

  • A list including:
  • betaThe beta coefficients.
  • sebThe standard error of the beta coefficients.
  • estThe fitted values if xnew is NULL, or the predicted values otherwise.

Details

The additive log-ratio transformation is applied and then the chosen multivariate regression is implemented. The alr is easier to explain than the ilr and that is why the latter is avoided here.

References

Mardia K.V., Kent J.T., and Bibby J.M. (1979). Multivariate analysis. Academic press. Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.

See Also

multivreg, spatmed.reg, esov.compreg, diri.reg

Examples

Run this code
library(MASS)
y <- iris[, 1:3]
x <- iris[, 4]
mod1 <- comp.reg(y, x)
mod2 <- comp.reg(y, x, type = "spatial")
mod1
mod2

Run the code above in your browser using DataLab