Skip to contents

Dargel and Thomas-Agnan (2024) show to compute variances and confidence intervals for parameters of CoDa models in log-ratio spaces.

Of particular interest are the clr parameters since they can be directly interpreted as differences from an average elasticity.

Another option is interpret the difference in clr parameters as these coincide with the difference in elasticities.

Usage

# S3 method for lmCoDa
confint(object, parm, level = 0.95, y_ref = NULL, obs = NULL, ...)

Arguments

object

class "lmCoDa"

parm

a character, indicating the name of one explanatory variable

level

a numeric, indicating the confidence level required

y_ref

an optional argument that indicates the reference component of the response variable using its name or its position.
This argument is only used in the Y-compositional model. If it is supplied confidence intervals of difference are used instead of the direct intervals of the parameters.

obs

an optional integer that indicates one observation when this argument is supplied the function return the observation dependent elasticity

...

passed on to confit()

Value

data.frame

Details

Since CoDa models are often multivariate this function only allows to specify one explanatory variable at a time. The output is also more complex than the usual one for "lm" classes, because we have to indicate the component of Y and X. With confint.lm() it is still possible to compute the usual the confidence intervals.

References

  • Dargel, Lukas and Christine Thomas-Agnan, “Pairwise share ratio interpretations of compositional regression models”, Computational Statistics & Data Analysis 195 (2024), p. 107945

Author

Lukas Dargel

Examples


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

## ---- CI for scalar X
# CI for clr parameters
confint(res, "unemp_rate")
#>               Y          X        EST       SD       2.5 %    97.5 %
#> 1          left unemp_rate   1.903993 5.473901  -9.7633504 13.571336
#> 2         right unemp_rate -12.240237 5.000438 -22.8984177 -1.582056
#> 3 extreme_right unemp_rate  10.336244 4.634737   0.4575352 20.214953
# CI for difference in clr parameters (coincides with difference in the semi elasticity)
confint(res, "unemp_rate", y_ref = 1)
#>   Y_ref             Y          X       DIFF       SD     2.5 %   97.5 %
#> 1  left          left unemp_rate   0.000000 0.000000   0.00000  0.00000
#> 2  left         right unemp_rate -14.144230 9.405060 -34.19064  5.90218
#> 3  left extreme_right unemp_rate   8.432251 8.825213 -10.37824 27.24275

## ---- CI for compositional X
# CI for clr parameters
confint(res, "cbind(Age_1839, Age_4064)")
#>               Y        X        EST        SD     2.5 %   97.5 %
#> 1          left Age_1839  0.4116622 0.9179218 -1.544842 2.368166
#> 2         right Age_1839  0.1906355 0.8385265 -1.596641 1.977912
#> 3 extreme_right Age_1839 -0.6022978 0.7772020 -2.258865 1.054269
#> 4          left Age_4064 -0.4116622 0.9179218 -2.368166 1.544842
#> 5         right Age_4064 -0.1906355 0.8385265 -1.977912 1.596641
#> 6 extreme_right Age_4064  0.6022978 0.7772020 -1.054269 2.258865

# CI for difference in clr parameters (coincides with difference in the elasticity)
confint(res, "cbind(Age_1839, Age_4064)", y_ref = 1)
#>   Y_ref             Y        X       DIFF       SD     2.5 %   97.5 %
#> 1  left          left Age_1839  0.0000000 0.000000  0.000000 0.000000
#> 2  left         right Age_1839 -0.2210267 1.577140 -3.582621 3.140568
#> 3  left extreme_right Age_1839 -1.0139600 1.479905 -4.168304 2.140384
#> 4  left          left Age_4064  0.0000000 0.000000  0.000000 0.000000
#> 5  left         right Age_4064  0.2210267 1.577140 -3.140568 3.582621
#> 6  left extreme_right Age_4064  1.0139600 1.479905 -2.140384 4.168304