# assoc.twocat: Cross-tabulation and measures of association between two... In GDAtools: A Toolbox for Geometric Data Analysis and More

 assoc.twocat R Documentation

## Cross-tabulation and measures of association between two categorical variables

### Description

Cross-tabulation and measures of association between two categorical variables

### Usage

```assoc.twocat(x,y,weights=rep.int(1,length(x)),na_value=NULL,nperm=NULL,distrib="asympt")
```

### Arguments

 `x` the first categorical variable (must be a factor) `y` the second categorical variable (must be a factor) `weights` an optional numeric vector of weights (by default, a vector of 1 for uniform weights) `na_value` character. Name of the level for NA category. If NULL (default), NA values are ignored. `nperm` numeric. Number of permutations for the permutation test of independence. If NULL (default), no permutation test is performed. Default is 1000. `distrib` the null distribution of permutation test of independence can be approximated by its asymptotic distribution (`"asympt"`, default) or via Monte Carlo resampling (`"approx"`.

### Value

A list with the following elements :

 `freq` cross-tabulation `prop` percentages `rprop` row percentages `cprop` column percentages `expected` expected values `chi.squared` chi-squared value `cramer.v` Cramer's V between the two variables `permutation.pvalue` p-value from a permutation (so non-parametric) test of independence `pearson.residuals` the table of Pearson residuals, i.e. (observed - expected) / sqrt(expected). `phi` the table of the phi coefficients for each pair of levels `phi.perm.pval` the table of permutation p-values for each pair of levels `gather` a data frame gathering informations, with one row per cell of the cross-tabulation

Nicolas Robette

### References

Rakotomalala R., 'Comprendre la taille d'effet (effect size)', http://eric.univ-lyon2.fr/~ricco/cours/slides/effect_size.pdf

`assoc.catcont`, `assoc.twocont`, `assoc.yx`, `condesc`, `catdesc`, `darma`, `ggassoc_crosstab`, `ggassoc_phiplot`
```data(Music)