cramer {pedometrics}R Documentation

Association between categorical variables

Description

Compute the Cramer's V, a descriptive statistic that measures the association between categorical variables.

Usage

cramer(x)

Arguments

x

Data frame or matrix with a set of categorical variables.

Details

Any integer variable is internally converted to a factor.

Value

A matrix with the Cramer's V between the categorical variables.

Note

The original code is available at http://sas-and-r.blogspot.nl/, Example 8.39: calculating Cramer's V, posted by Ken Kleinman on Friday, June 3, 2011. As such, Ken Kleinman <Ken_Kleinman@hms.harvard.edu> is entitled a ‘contributor’ to the R-package pedometrics.

The function bigtabulate used to compute the chi-squared test is the main bottleneck in the current version of cramer. Ideally it will be implemented in C++.

Author(s)

Alessandro Samuel-Rosa alessandrosamuelrosa@gmail.com

References

Cramér, H. Mathematical methods of statistics. Princeton: Princeton University Press, p. 575, 1946.

Everitt, B. S. The Cambridge dictionary of statistics. Cambridge: Cambridge University Press, p. 432, 2006.

See Also

assocstats

Examples

## Not run: 
data <- read.csv("http://www.math.smith.edu/r/data/help.csv")
data <- data[, c("female", "homeless", "racegrp")]
str(data)
test <- cramer(data)
test

## End(Not run)

[Package pedometrics version 0.6-6 Index]