Cross-tabulation and measures of association between two categorical variables
assoc.twocat(x,y,weights=rep.int(1,length(x)),na_value=NULL,nperm=NULL,distrib="asympt")
the first categorical variable (must be a factor)
the second categorical variable (must be a factor)
an optional numeric vector of weights (by default, a vector of 1 for uniform weights)
character. Name of the level for NA category. If NULL (default), NA values are ignored.
numeric. Number of permutations for the permutation test of independence. If NULL (default), no permutation test is performed. Default is 1000.
the null distribution of permutation test of independence can be approximated by its asymptotic distribution ("asympt"
, default) or via Monte Carlo resampling ("approx"
.
A list with the following elements :
cross-tabulation
percentages
row percentages
column percentages
expected values
chi-squared value
Cramer's V between the two variables
p-value from a permutation (so non-parametric) test of independence
the table of Pearson residuals, i.e. (observed - expected) / sqrt(expected).
the table of the phi coefficients for each pair of levels
the table of permutation p-values for each pair of levels
the table of local Percentages of Maximum Deviation from Independences
value of the global Percentage of Maximum Deviation from Independence
a data frame gathering informations, with one row per cell of the cross-tabulation
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
# NOT RUN {
data(Music)
assoc.twocat(Music$Jazz,Music$Age,nperm=100)
# }
Run the code above in your browser using DataLab