Learn R Programming

Connection (version 0.1.0)

Cramer_V: Cramer V Statistic for Strength of Association

Description

Computes Cramer V to assess the strength of association between two categorical variables.

Usage

Cramer_V(a, b)

Value

A numeric value between 0 and 1 representing the strength of association (Cramer V).

Arguments

a

A numeric or categorical vector (used for rows in the contingency table).

b

A numeric or categorical vector (used for columns in the contingency table).

Details

This measure is derived from the Chi-squared statistic and a contingency table. Both parameters can be a categorical variable, allowing flexibility in working with labelled data. Variable a is treated as rows and b as columns in the contingency table. The function supports both elementary data records and grouped frequency distributions.

Examples

Run this code
Cramer_V(c(1, 1, 1, 4, 6), c("a", "b", "c", "c", "c"))

Run the code above in your browser using DataLab