VariationTable {CoDaImpact} | R Documentation |
Effects of infinitesimal changes in CoDa models
Description
This function allows to evaluate how a change in an explanatory variables impacts the response variable in a CoDa regression model. The changes are calculated based from the approximate formal presented in Dargel and Thomas-Agnan (2024). Changes in the response variables are provided as data.frame and the underlying changes in the explanatory variable are given as attributes.
Usage
VariationTable(
object,
Xvar,
Xdir,
obs = 1,
inc_size = 0.1,
inc_rate = NULL,
Ytotal = 1,
normalize_Xdir = TRUE
)
Arguments
object |
an object of class "lmCoDa" |
Xvar |
a character indicating the name of the explanatory variable that changes |
Xdir |
either character or numeric, to indicate the direction in which Xvar should change
|
obs |
a numeric indicating the observation used for the scenario |
inc_size |
a numeric indicating the distance between each point in the scenario of X |
inc_rate |
a numeric that can be used as a parameterization of the step size |
Ytotal |
a numeric indicating the total of Y |
normalize_Xdir |
a logical, if |
Value
data.frame
Author(s)
Lukas Dargel
Rodrigue Nasr
References
Dargel, Lukas and Christine Thomas-Agnan, “Pairwise share ratio interpretations of compositional regression models”, Computational Statistics & Data Analysis 195 (2024), p. 107945
Examples
# XY-compositional model
res <- lmCoDa(
ilr(cbind(left, right, extreme_right)) ~
ilr(cbind(Educ_BeforeHighschool, Educ_Highschool, Educ_Higher)),
data = head(election, 20))
# Focus on changes in the education composition
educ_comp <- "cbind(Educ_BeforeHighschool, Educ_Highschool, Educ_Higher)"
# ... changes towards a summit towards a summit (higher share of people with lower education)
VariationTable(res, educ_comp, Xdir = "Educ_BeforeHighschool")
# ... same changes using a compositional vector as direction
VariationTable(res, educ_comp, Xdir = c(.5,.25,.25))
# ... changes in a more general direction and for a different observation
VariationTable(res, educ_comp, Xdir = c(.35,.45,.10), obs = 2)