cramersv {confintr} | R Documentation |
Cramer's V
Description
This function calculates Cramer's V, a measure of association between two categorical variables.
Usage
cramersv(x)
Arguments
x |
The result of |
Details
Cramer's V is a scaled version of the chi-squared test statistic and
takes values in
. It is calculated as
, where
is the number of observations,
and
is the smaller of the number of levels of the two variables.
Yates continuity correction is never applied. So in the 2x2 case, if x
is the
result of stats::chisq.test()
, make sure no continuity correction was applied.
Otherwise, results can be inconsistent.
Value
A numeric vector of length one.
References
Cramer, Harald. 1946. Mathematical Methods of Statistics. Princeton: Princeton University Press, page 282 (Chapter 21. The two-dimensional case).
See Also
Examples
cramersv(mtcars[c("am", "vs")])