Learn R Programming

CoDaImpact (version 0.1.0)

lmCoDa: Estimating CoDa regression models

Description

This is a thin wrapper around lm() followed by ToSimplex(), which allows to create a lmCoDa object in one step.

Usage

lmCoDa(formula, data, ...)

Value

an object of class "lm" and "lmCoDa" if the formula include at least one log-transformation

Arguments

formula

as in lm()

data

as in lm()

...

arguments passed on to lm()

Author

Lukas Dargel

See Also

lm(), ToSimplex(), compositions::ilr(), compositions::alr()

Examples

Run this code

# XY-compositional model
res <- lmCoDa(
  ilr(cbind(left, right, extreme_right)) ~
  ilr(cbind(Educ_BeforeHighschool, Educ_Highschool, Educ_Higher)),
  data =  head(election, 20))

# X-compositional model
res <- lmCoDa(YIELD ~ PRECIPITATION + ilr(TEMPERATURES), data = head(rice_yields, 20))

Run the code above in your browser using DataLab