🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
💼 Servicesℹ️ About✉️ ContactView Pricing Plansfrom $10

Cramér's V — Effect Size for Chi-Square Tests

Foundations of StatisticsDescriptive Statistics🟢 Free Lesson

Cramér's V

Descriptive Statistics

Effect Size for Any Contingency Table — Not Just 2×2

The chi-square test tells you whether an association exists, but not how strong it is. Cramér's V normalizes the chi-square statistic into a bounded measure from 0 to 1, giving you the effect size regardless of table dimensions.

Key things Cramér's V helps you understand:

  • Universal categorical association — Works for tables of any size (2×2, 3×4, 5×5), unlike phi which is limited to 2×2.
  • Effect size interpretation — Cohen's guidelines (0.1 small, 0.3 medium, 0.5 large) provide a quick rule of thumb.
  • Dependence on table dimensions — The same V value means different things for a 2×2 table versus a 5×5 table; always report table size alongside V.

Chi-square asks "is there an association?" — Cramér's V answers "how strong is it?"


What is Cramér's V?

Definition

Cramér's V measures the strength of association between two categorical variables, based on the chi-square statistic.


python
import numpy as np
from scipy import stats

# Create a contingency table (e.g., Hair Color vs Eye Color)
table = np.array([
    [68, 119, 26],
    [20, 84, 17],
    [15, 54, 14]
])

chi2, p_value, dof, expected = stats.chi2_contingency(table)
n = table.sum()
r, c = table.shape
v = np.sqrt(chi2 / (n * (min(r-1, c-1))))

print(f"Contingency table:\n{table}")
print(f"\nChi-square = {chi2:.4f}")
print(f"Cramér's V = {v:.4f}")
print(f"p-value    = {p_value:.2e}")

Interpretation Guidelines (Cohen's Rules)

V ValueInterpretation
0.00 – 0.10Negligible association
0.10 – 0.30Weak association
0.30 – 0.50Moderate association
0.50+Strong association

Python Implementation

python
def cramers_v(table):
    """Calculate Cramér's V for any contingency table."""
    chi2, _, _, _ = stats.chi2_contingency(table)
    n = table.sum()
    r, c = table.shape
    return np.sqrt(chi2 / (n * (min(r-1, c-1))))

# Test with different tables
table_2x2 = np.array([[50, 30], [20, 40]])
table_3x3 = np.array([[30, 10, 5], [15, 25, 10], [5, 10, 30]])

print(f"2x2 table V = {cramers_v(table_2x2):.4f}")
print(f"3x3 table V = {cramers_v(table_3x3):.4f}")

Cramér's V vs Phi Coefficient

FeaturePhi (φ)Cramér's V
Table size2×2 onlyAny r×c
Maximum value1.01.0 (for 2×2), <1.0 for larger
Formulaφ = √(χ²/n)V = √(χ²/(n·min(r-1,c-1)))
Use caseBinary vs binaryAny categorical vs categorical

Cramer's V in Machine Learning

ML ApplicationCramer's V UsageWhy
Feature selectionCategorical vs categoricalKnow which features relate
NLPWord co-occurrence strengthFeature engineering
Data validationCheck data relationshipsSanity checks
python
import numpy as np
import pandas as pd
from scipy.stats import chi2_contingency

# Create contingency table
data = pd.DataFrame({
    'weather': np.random.choice(['sunny', 'rainy', 'cloudy'], 200),
    'activity': np.random.choice(['indoor', 'outdoor'], 200)
})
contingency = pd.crosstab(data['weather'], data['activity'])

chi2, p, dof, expected = chi2_contingency(contingency)
n = contingency.sum().sum()
min_dim = min(contingency.shape) - 1
v = np.sqrt(chi2 / (n * min_dim))
print(f"Chi-square: {chi2:.3f}, p-value: {p:.4f}")
print(f"Cramer's V: {v:.4f} (0=no association, 1=perfect)")

Key Takeaways

Cramér's V measures association between any two categorical variables — generalizes phi to tables of any size.

V ranges from 0 to 1 — 0 means no association, 1 means perfect association.

Based on chi-square — V = √(χ²/(n·min(r-1, c-1))), linking the test of independence directly to effect size.

Interpretation depends on table size — always report table dimensions alongside V, and use Cohen's guidelines as a starting point.

"The chi-square test tells you something is going on; Cramér's V tells you how much — and the table dimensions tell you how to interpret it."


Extended Learning: Beyond the Basics

Key Concepts Summary

This lesson covers fundamental concepts that serve as building blocks for more advanced topics. Master these basics before moving to intermediate and advanced material.

Prerequisite Knowledge

Before studying this topic in depth, ensure you understand:

  • Basic definitions and terminology
  • Core formulas and their derivations
  • Common applications in real-world scenarios
  • Typical pitfalls and misconceptions

Step-by-Step Walkthrough

Let us work through a complete example to solidify understanding:

Step 1: Identify the problem type. Determine which category this problem falls into and which approach is most appropriate.

Step 2: Apply the relevant formula. Substitute known values into the appropriate equation, paying attention to units and constraints.

Step 3: Simplify and solve. Work through the algebra step by step, checking each intermediate result.

Step 4: Verify the answer. Check that the solution satisfies the original conditions and makes logical sense.

Common Mistakes to Avoid

  1. Misidentifying the problem type — Always start by categorizing the problem
  2. Incorrect formula application — Verify the formula applies to your specific case
  3. Unit errors — Always check units are consistent throughout
  4. Sign errors — Pay careful attention to positive and negative values
  5. Rounding too early — Keep full precision until the final answer
  6. Forgetting constraints — Check that solutions satisfy all given conditions

Real-World Applications

Understanding this concept is essential for:

  • Advanced problem solving in examinations
  • Building intuition for more complex topics
  • Developing analytical thinking skills
  • Applying mathematical reasoning to practical situations

Practice Exercises

  1. Basic: Solve 5 problems of increasing difficulty using the core concept.
  2. Intermediate: Apply the concept to word problems with multiple steps.
  3. Advanced: Combine this concept with 2-3 other topics in a comprehensive problem.
  4. Challenge: Create your own problem that requires this concept plus additional knowledge.

Interview and Exam Tips

  • Common question patterns: Identify which exam or interview formats test this topic
  • Time management: Practice completing problems within time constraints
  • Common traps: Know the typical mistakes examiners set as distractors
  • Verification strategy: Develop a quick method to check your answer

Related Topics

Quick Reference Card

ConceptFormula/RuleKey InsightCommon Use
Core DefinitionSee main textUnderstand the intuitionFoundation for all applications
Key FormulaSee main textMemorize the derivationDirect problem solving
Special CaseSee main textRecognize when it appliesSimplifies complex problems
Edge CaseSee main textKnow the limitationsAvoids errors

Further Reading

For students who want to go deeper:

  • Standard textbooks on the subject
  • Research papers applying this concept
  • Online courses with video explanations
  • Practice problem collections with detailed solutions
CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-11-14

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert Statistics Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement