Chi-Square Calculator

Test statistical independence in 2×2 contingency tables and goodness-of-fit distributions with exact p-values, Cramér's V, and odds ratios.

Calculation Mode
Calculation Inputs

Test independence between two categorical variables with two levels each.

Auto-Computed
Statistical Visualizations & Distributions

Interactive, data-driven visualization computed from your current input values.

Chi-Square Sampling Distribution (df = 1)

H₀: Row and Column attributes are independent. Observed χ² = 11.43

Null Distribution H₀P-Value Area (0.00072)Critical α CutoffObserved (11.43)
χ²_crit (3.84)χ²: 11.4302.75.3810.713.316Chi-Square Statistic (χ²)Density f(χ²)
Statistical Analysis SummaryStatistically Significant
Chi-Square (χ²)
11.4286
Critical Value: ±3.8415
P-Valueα = 0.05
0.00072
p < 0.05 (Significant at α)
Cramér's V0.378Moderate association
Degrees of Freedom (df)1
Sample Size (N)80

Step-by-Step Mathematical Derivation

Detailed derivation with exact formulas, user input substitutions, and statistical interpretations.

Step 1

Calculate Marginal & Grand Totals

Formula
N = R1 + R2 = C1 + C2
Substitution & Values
R1 = 40, R2 = 40, C1 = 35, C2 = 45, N = 80
Result:
Total N = 80

Sums across rows and columns to establish sample marginal proportions.

Step 2

Compute Expected Frequencies under Independence

Formula
Eij = Ri × CjN
Substitution & Values
EA = 40 × 3580, EB = 40 × 4580, EC = 40 × 3580, ED = 40 × 4580
Result:
EA = 17.5, EB = 22.5, EC = 17.5, ED = 22.5

All expected frequencies satisfy Cochran's rule (E ≥ 5).

Step 3

Compute Chi-Square Contributions

Formula
χ2 = ∑ (Oij − Eij)2Eij
Substitution & Values
(25−17.5)217.5 + (15−22.5)222.5 + (10−17.5)217.5 + (30−22.5)222.5
Result:
χ2 = 11.4286

Sums squared standard residuals across all 4 contingency cells.

Step 4

P-Value & Degrees of Freedom

Formula
p = P(χ21 ≥ χ2calc), df = (r−1)(c−1) = 1
Substitution & Values
χ2 = 11.4286, df = 1, α = 0.05
Result:
p = 0.00072, χ2crit = 3.8415

Comparing observed statistic to χ² critical threshold at α = 0.05: Reject H₀ at α = 0.05 (Significant Association Between Variables).

Step 5

Effect Size (Cramér's V & Odds Ratio)

Formula
V = √χ2N, OR = a · db · c
Substitution & Values
V = √11.42980, OR = 25 × 3015 × 10
Result:
V = 0.378, OR = 5

Cramér's V of 0.378 reflects a moderate association between attributes.

Statistical Interpretation & Assumptions

Evaluation & Analysis Guidelines

Statistical Decision: Reject H₀ at α = 0.05 (Significant Association Between Variables)
Required Assumptions:
  • Observations are mutually exclusive categorical counts
  • Cochran's rule satisfied: all expected frequencies ≥ 5

Chi-Square Independence & Goodness of Fit Formulas

Formulas for observed vs expected frequency tables, degrees of freedom, and upper-tail incomplete gamma functions.

Pearson's Chi-Square Test of Independence

χ2 = ∑ (Oij − Eij)2Eij, Eij = Ri × CjN

Evaluates whether two categorical attributes are statistically independent by comparing observed counts against expected counts under the independence assumption.

Worked Example: With cell counts A=25, B=15, C=10, D=30 (N=80): Row 1=40, Col 1=35. E_A = (40×35)/80 = 17.5. Computing all cells yields χ² = 11.4286, df = 1, p = 0.00072 (Significant).

Chi-Square Goodness-of-Fit

χ2 = k∑i=1 (Oi − Ei)2Ei, df = k − 1

Tests whether an observed categorical frequency distribution differs from a theoretical or hypothesized model.

Worked Example: Rolling a die 60 times with uniform expectation (10 per face). If χ² exceeds critical threshold (11.07 for df=5 at α=0.05), reject fair die assumption.

Cramér's V Effect Size & Odds Ratio

V = √χ2N · min(r−1, c−1), OR = A × DB × C

Quantifies association strength independently of sample size N via Cramér's V (0 to 1), while Odds Ratio measures relative outcome likelihood across rows in a 2×2 table.

Worked Example: For χ² = 11.4286 and N = 80 in a 2×2 table: V = √(11.4286 / 80) = 0.378 (Medium-Large association), OR = (25 × 30) / (15 × 10) = 5.0.

Step-by-Step Guide: Contingency Independence & Goodness-of-Fit Chi-Square

Evaluates relationships between categorical count variables by measuring squared normalized discrepancies between observed frequencies (O) and null-expected counts (E).

  1. 1

    Enter Raw Count Frequencies (Not Percentages)

    In 2×2 Contingency Independence mode, input the four raw cell counts (A, B, C, D). In Goodness-of-Fit mode, provide observed counts alongside expected theoretical counts.

  2. 2

    Verify Expected Cell Frequency Rules

    Each expected cell count E = (Row Total × Column Total) ÷ N represents what would occur purely by independence.

  3. 3

    Interpret χ², P-Value, Cramér's V & Odds Ratio

    Because χ² is strictly non-negative, the right tail beyond observed χ² determines significance, while Cramér's V measures association strength regardless of sample size.

Chi-Square Critical Cutoffs (α = 0.05) & Cramér's V Benchmarks

Standard right-tail χ² rejection thresholds by degrees of freedom and association strength rules.

Degrees of Freedom (df)Critical χ² (α = 0.10)Critical χ² (α = 0.05)Critical χ² (α = 0.01)Cramér's V (df*=1)
df = 1 (2×2 Table)2.70553.84156.63490.10 = Small effect
df = 24.60525.99159.21030.30 = Medium effect
df = 36.25147.814711.34490.50 = Large effect
df = 47.77949.487713.2767Range: [0, 1]
df = 59.236411.070515.0863Sample-size invariant

Cochran's Expected Count Rules & Data Requirements

Cochran's Rule for Small Samples

In a 2×2 contingency table, all four expected cell counts must be ≥ 5; in larger tables, ≥ 80% of cells must have E ≥ 5 and none < 1. If expected counts drop below 5, use Fisher's Exact Test.

Independent Mutually Exclusive Observations

Every observation in the contingency table must represent an independent trial belonging to exactly one row and one column category (no repeated measurements on the same individual).

Chi-Square Calculator — Worked Examples

Real-world scenarios and verified benchmark inputs for the Chi-Square Calculator.

Marketing Campaign 2×2 Association

Testing independence between landing page design (A vs B) and conversion counts (Yes vs No) across 80 visitors.

Resultχ² = 11.4286, df = 1, p = 0.00072 (Reject H₀)

Quarterly Customer Preference Goodness-of-Fit

Comparing observed counts [30, 20, 35, 15] across 4 categories against an equal expected distribution [25, 25, 25, 25].

Resultχ² = 10.0000, df = 3, p = 0.01857 (Reject H₀)

Six-Sided Die Fairness Validation

Testing observed roll frequencies across 6 faces against equal expectation (10 per face) over 60 throws.

Resultχ² = 3.4000, df = 5, p = 0.63857 (Fail to Reject H₀)

Chi-Square Calculator — Frequently Asked Questions

Questions about contingency tables, Cochran's minimum cell frequency rules, Fisher's exact test, and Cramér's V.

What is Cochran's rule for minimum expected frequencies?

Cochran's rule states that for a valid chi-square test, no expected cell frequency should be below 1, and at least 80% of cells should have expected frequencies of 5 or more. In a 2×2 table, all 4 expected counts must be ≥ 5; otherwise, Fisher's Exact Test is recommended.

What does Cramér's V measure?

Cramér's V measures the strength of association between categorical variables on a scale from 0 (no association) to 1 (complete association), adjusting for sample size. For df* = 1 in a 2×2 table: 0.10 = small, 0.30 = medium, and 0.50 = large effect.

When should I use Chi-Square Goodness-of-Fit vs Chi-Square Test of Independence?

Use Goodness-of-Fit when you have one categorical variable and want to test whether its observed distribution matches expected theoretical proportions (e.g., uniform distribution or Mendelian 9:3:3:1 ratios). Use Test of Independence when examining whether two categorical variables are related across a contingency table.

Why is the Chi-Square hypothesis test always right-tailed?

Because every cell deviation (O − E)² is squared and divided by positive expected counts E, the test statistic χ² can never be negative. Zero represents an exact match between observed and expected data, whereas larger discrepancies produce strictly larger positive χ² values in the upper right tail.

Can I enter percentages instead of raw counts into a Chi-Square calculator?

No. The Chi-Square formula scales directly with sample size N. Entering percentages (which artificially sum to 100) instead of actual observed counts produces incorrect test statistics and invalid p-values.

How is Yates' continuity correction handled?

YourCalculate reports Pearson's standard unadjusted χ² statistic by default to maintain direct parity with textbook derivations, R's chisq.test(..., correct=FALSE), and large-sample contingency tables, while flagging small expected cell counts below 5.

Related Calculators

Explore connected statistics & probability and related computation tools.

Browse all Statistics & Probability calculators
Statistics & Probability

A/B Test Significance Calculator

Available
Statistics & Probability

P-Value Calculator

Available
Statistics & Probability

Z-Test Calculator

Available
Available