Learn R Programming

greybox (version 0.6.4)

cramer: Calculate Cramer's V for categorical variables

Description

Function calculates Cramer's V for two categorical variables based on the table function

Usage

cramer(x, y, use = c("na.or.complete", "complete.obs", "everything",
  "all.obs"))

Arguments

x

First categorical variable.

y

Second categorical variable.

use

What observations to use. See cor function for details. The only option that is not available here is "pairwise.complete.obs".

Value

The following list of values is returned:

  • valueThe value of Cramer's V;

  • statisticThe value of Chi squared statistic associated with the Cramer's V;

  • p.valueThe p-value of Chi squared test associated with the Cramer's V;

  • dfThe number of degrees of freedom from the test.

Details

The function calculates Cramer's V and also returns the associated statistics from Chi-Squared test with the null hypothesis of independence of the two variables.

See details in the vignette "Marketing analytics with greybox": vignette("maUsingGreybox","greybox")

See Also

table, tableplot, spread, mcor, association

Examples

Run this code
# NOT RUN {
cramer(mtcars$am, mtcars$gear)

# }

Run the code above in your browser using DataLab