indTab: Independence table In robCompositions: Compositional Data Analysis

Description

Estimates the expected frequencies from an m-way table under the null hypotheses of independence.

Usage

 ```1 2 3 4 5 6``` ```indTab( x, margin = c("gmean_sum", "sum"), frequency = c("relative", "absolute"), pTabMethod = c("dirichlet", "half", "classical") ) ```

Arguments

 `x` an object of class table `margin` determines how the margins of the table should be estimated (default via geometric mean margins) `frequency` indicates whether absolute or relative frequencies should be computed. `pTabMethod` to estimate the propability table. Default is ‘dirichlet’. Other available methods: ‘classical’ that is function `prop.table()` from package base or method “half” that add 1/2 to each cell to avoid zero problems.

Details

Because of the compositional nature of probability tables, the independence tables should be estimated using geometric marginals.

Value

The independence table(s) with either relative or absolute frequencies.

Matthias Templ

References

Egozcue, J.J., Pawlowsky-Glahn, V., Templ, M., Hron, K. (2015) Independence in contingency tables using simplicial geometry. Communications in Statistics - Theory and Methods, 44 (18), 3978–3996.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```data(precipitation) tab1 <- indTab(precipitation) tab1 sum(tab1) ## Not run: data("PreSex", package = "vcd") indTab(PreSex) ## End(Not run) ```

Example output

```Loading required package: robustbase

Attaching package: 'pls'

The following object is masked from 'package:stats':

Attaching package: 'robCompositions'

The following object is masked from 'package:robustbase':

alcohol

spring      summer     autumn     winter
30   0.16624904 0.068979028 0.19465063 0.17190559
60   0.02196747 0.009114608 0.02572034 0.02271490
125  0.02603079 0.010800535 0.03047783 0.02691648
250  0.02682659 0.011130724 0.03140958 0.02773935
500  0.02183422 0.009059321 0.02556433 0.02257712
1000 0.01335208 0.005539962 0.01563312 0.01380638
[1] 1
, , PremaritalSex = Yes, Gender = Women

ExtramaritalSex
MaritalStatus        Yes          No
Divorced 0.01439585 0.006014668
Married  0.02230781 0.011755467

, , PremaritalSex = No, Gender = Women

ExtramaritalSex
MaritalStatus        Yes          No
Divorced 0.01193176 0.004985160
Married  0.01848946 0.009743327

, , PremaritalSex = Yes, Gender = Men

ExtramaritalSex
MaritalStatus        Yes         No
Divorced 0.05112556 0.02136055
Married  0.07922417 0.04174848

, , PremaritalSex = No, Gender = Men

ExtramaritalSex
MaritalStatus       Yes        No
Divorced 0.1868179 0.0780536
Married  0.2894931 0.1525531
```

robCompositions documentation built on Jan. 13, 2021, 10:07 p.m.