cramerV | R Documentation |
Calculates Cramer's V for a table of nominal variables; confidence intervals by bootstrap. Function taken from the rcompanion Rpackage.
cramerV( x, y = NULL, ci = FALSE, conf = 0.95, type = "perc", R = 1000, histogram = FALSE, digits = 4, bias.correct = FALSE, reportIncomplete = FALSE, verbose = FALSE, ... )
x |
Either a two-way table or a two-way matrix. Can also be a vector of observations for one dimension of a two-way table. |
y |
If |
ci |
If |
conf |
The level for the confidence interval. |
type |
The type of confidence interval to use.
Can be any of " |
R |
The number of replications to use for bootstrap. |
histogram |
If |
digits |
The number of significant digits in the output. |
bias.correct |
If |
reportIncomplete |
If |
verbose |
If |
... |
Additional arguments passed to |
Cramer's V is used as a measure of association between two nominal variables, or as an effect size for a chi-square test of association. For a 2 x 2 table, the absolute value of the phi statistic is the same as Cramer's V.
Because V is always positive, if type="perc"
,
the confidence interval will
never cross zero. In this case,
the confidence interval range should not
be used for statistical inference.
However, if type="norm"
, the confidence interval
may cross zero.
When V is close to 0 or very large, or with small counts, the confidence intervals determined by this method may not be reliable, or the procedure may fail.
A single statistic, Cramer's V. Or a small data frame consisting of Cramer's V, and the lower and upper confidence limits.
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
http://rcompanion.org/handbook/H_10.html
cohenW
### Example with table data(Anderson) fisher.test(Anderson) cramerV(Anderson) ### Example with two vectors Species = c(rep("Species1", 16), rep("Species2", 16)) Color = c(rep(c("blue", "blue", "blue", "green"),4), rep(c("green", "green", "green", "blue"),4)) fisher.test(Species, Color) cramerV(Species, Color)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.