Cross-tabulation and measures of association between two categorical variables
assoc.twocat(x, y, weights = NULL, na.rm = FALSE, na.value = "NA",
nperm = NULL, distrib = "asympt")A list of lists with the following elements :
tables list :
cross-tabulation frequencies
percentages
row percentages
column percentages
expected values
global list :
chi-squared value
Cramer's V between the two variables
p-value from a permutation (i.e. non-parametric) test of independence
global PEM
Goodman and Kruskal tau (forward association, i.e. x is the predictor and y is the response)
Goodman and Kruskal tau (backward association, i.e. y is the predictor and x is the respons)
local list :
the table of standardized (i.e.Pearson) residuals.
the table of adjusted standardized residuals.
the table of p-values of adjusted standardized residuals.
the table of odds ratios.
the table of local PEM
the table of the phi coefficients for each pair of levels
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.
the first categorical variable (must be a factor)
the second categorical variable (must be a factor)
numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used.
logical, indicating whether NA values should be silently removed before the computation proceeds. If FALSE (default), an additional level is added to the variables (see na.value argument).
character. Name of the level for NA category. Default is "NA". Only used if na.rm = FALSE.
numeric. Number of permutations for the permutation test of independence. If NULL (default), no permutation test is performed.
the null distribution of permutation test of independence can be approximated by its asymptotic distribution (asympt, default) or via Monte Carlo resampling (approx).
Nicolas Robette
Agresti, A. (2007). An Introduction to Categorical Data Analysis, 2nd ed. New York: John Wiley & Sons.
Rakotomalala R., Comprendre la taille d'effet (effect size), http://eric.univ-lyon2.fr/~ricco/cours/slides/effect_size.pdf
Lebart L., Morineau A. and Warwick K., 1984, *Multivariate Descriptive Statistical Analysis*, John Wiley and sons, New-York.
assoc.catcont, assoc.twocont, assoc.yx, condesc,
catdesc, darma
data(Movies)
assoc.twocat(Movies$Country, Movies$ArtHouse, nperm=100)
Run the code above in your browser using DataLab