φc is the intercorrelation of two discrete variables and may be used with variables having two or more levels. φc is a symmetrical measure, it does not matter which variable we place in the columns and which in the rows. Also, the order of rows/columns doesn't matter, so φc may be used with nominal data types or higher. Cramér's V may also be applied to goodness of fit chi-squared models when there is a 1 × ktable. In this case k is taken as the number of optional outcomes and it functions as a measure of tendency towards a single outcome. Cramér's V varies from 0 to 1 and can reach 1 only when each variable is completely determined by the other. φc2 is the mean squarecanonical correlation between the variables. In the case of a 2 × 2 contingency table Cramér's V is equal to the Phi coefficient. Note that as chi-squared values tend to increase with the number of cells, the greater the difference between r and c, the more likely φc will tend to 1 without strong evidence of a meaningful correlation. V may be viewed as the association between two variables as a percentage of their maximum possible variation. V2 is the mean square canonical correlation between the variables.
Calculation
Let a sample of size n of the simultaneously distributed variables and for be given by the frequencies The chi-squared statistic then is: Cramér's V is computed by taking the square root of the chi-squared statistic divided by the sample size and the minimum dimension minus 1: where:
The p-value for the significance of V is the same one that is calculated using the Pearson's chi-squared test. The formula for the variance of V=φc is known. In R, the function cramerV from the package rcompanion calculates V using the chisq.test function from the stats package. In contrast to the function cramersV from the lsr package, cramerV also offers an option to correct for bias. It applies the correction described in the following section.
Bias correction
Cramér's V can be a heavily biased estimator of its population counterpart and will tend to overestimate the strength of association. A bias correction, using the above notation, is given by where and Then estimates the same population quantity as Cramér's V but with typically much smaller mean squared error. The rationale for the correction is that under independence,