cor.cramer | R Documentation |
This function computes the (bias-corrected) Cramer's V between two or more than two variables.
cor.cramer(x, correct = TRUE, tri = c("both", "lower", "upper"), digits = 2,
as.na = NULL, check = TRUE, output = TRUE)
x |
a matrix or data frame with integer vectors, character vectors or factors. |
correct |
logical: if |
tri |
a character string or character vector indicating which triangular of the matrix
to show on the console, i.e., |
digits |
an integer value indicating the number of decimal places digits to be used for displaying Cramer's V. |
as.na |
a numeric vector indicating user-defined missing values,
i.e. these values are converted to |
check |
logical: if |
output |
logical: if |
Cramer's V can have large bias tending to overestimate the strength of association which depends on the size of the table and the sample size. As proposed by Bergsma (2013) a bias correction can be applied to obtain the bias-corrected Cramer's V.
Returns an object of class misty.object
, which is a list with following
entries:
call |
function call |
type |
type of analysis |
data |
matrix or data frame specified in |
args |
specification of function arguments |
result |
result table |
Takuya Yanagida takuya.yanagida@univie.ac.at
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. John Wiley & Sons.
Bergsma, W. (2013). A bias correction for Cramer's V and Tschuprow's T. Journal of the Korean Statistical Society, 42, 323-328. https://doi.org/10.1016/j.jkss.2012.10.002
cor.matrix
, cor.cont
, cor.phi
, cor.poly
,
cohens.d
.
dat <- data.frame(x = c(1, 1, 2, 1, 3, 3, 2, 2, 1, 2),
y = c(1, 2, 2, 1, 3, 4, 1, 2, 3, 1),
z = c(1, 1, 2, 1, 2, 3, 1, 2, 3, 2))
# Bias-corrected Cramer's V between x and y
cor.cramer(dat[, c("x", "y")])
# Cramer's V between x and y
cor.cramer(dat[, c("x", "y")], correct = FALSE)
# Bias-corrected Cramer's V matrix between x, y, and z
cor.cramer(dat[, c("x", "y", "z")])
# Cramer's V matrix between x, y, and z
cor.cramer(dat[, c("x", "y", "z")], correct = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.