Chi-Square Test Calculator
Calculate chi-square statistics for goodness of fit and test of independence with p-values, critical values, and step-by-step analysis.
Enter Observed and Expected Frequencies
| Category | Observed | Expected | Action |
|---|---|---|---|
| Category 1 | |||
| Category 2 | |||
| Category 3 |
Critical Values Reference
Chi-square critical values for common significance levels:
| df | 0.10 | 0.05 | 0.01 | 0.001 |
|---|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 | 10.828 |
| 2 | 4.605 | 5.991 | 9.210 | 13.816 |
| 3 | 6.251 | 7.815 | 11.345 | 16.266 |
| 4 | 7.779 | 9.488 | 13.277 | 18.467 |
| 5 | 9.236 | 11.070 | 15.086 | 20.515 |
| 6 | 10.645 | 12.592 | 16.812 | 22.458 |
| 7 | 12.017 | 14.067 | 18.475 | 24.322 |
| 8 | 13.362 | 15.507 | 20.090 | 26.125 |
| 9 | 14.684 | 16.919 | 21.666 | 27.877 |
| 10 | 15.987 | 18.307 | 23.209 | 29.588 |
| 12 | 18.549 | 21.026 | 26.217 | 32.909 |
| 15 | 22.307 | 24.996 | 30.578 | 37.697 |
| 20 | 28.412 | 31.410 | 37.566 | 45.315 |
| 25 | 34.382 | 37.652 | 44.314 | 52.620 |
| 30 | 40.256 | 43.773 | 50.892 | 59.703 |
Understanding the Chi-Square Test
What is the Chi-Square Test?
The chi-square test is a statistical method used to determine if there is a significant association between categorical variables or if observed frequencies differ from expected frequencies. The test calculates a statistic that measures the discrepancy between what we observe and what we expect under the null hypothesis.
Chi-Square Formula
The chi-square statistic is calculated as:
χ² = Σ[(O - E)² / E]
Where O is the observed frequency and E is the expected frequency for each category or cell.
Types of Chi-Square Tests
1. Goodness of Fit Test
Tests whether observed sample data fits a hypothesized distribution. Used when you have one categorical variable.
- Null hypothesis: The data follows the expected distribution
- Degrees of freedom: k - 1 (where k is the number of categories)
- Example: Testing if a die is fair by comparing observed rolls to expected uniform distribution
2. Test of Independence
Tests whether two categorical variables are independent or related. Used when you have two categorical variables in a contingency table.
- Null hypothesis: The two variables are independent
- Degrees of freedom: (rows - 1) × (columns - 1)
- Example: Testing if gender and voting preference are independent
- Expected frequency for each cell: (row total × column total) / grand total
Interpreting Results
P-Value Interpretation
- p < 0.05: Strong evidence against null hypothesis (typically significant)
- p < 0.01: Very strong evidence against null hypothesis
- p < 0.001: Extremely strong evidence against null hypothesis
- p >= 0.05: Insufficient evidence to reject null hypothesis
Cramer's V Effect Size
For test of independence, Cramer's V measures the strength of association:
- 0.00 - 0.10: Negligible association
- 0.10 - 0.30: Weak association
- 0.30 - 0.50: Moderate association
- 0.50+: Strong association
Assumptions and Requirements
- Independence: Observations must be independent of each other
- Sample Size: Expected frequency in each cell should be at least 5
- Random Sampling: Data should be collected through random sampling
- Categorical Data: Variables must be categorical (not continuous)
Common Applications
- Market research: Testing if product preference differs by demographic group
- Medical studies: Testing if treatment outcome is independent of patient characteristics
- Quality control: Testing if defect rates are consistent across production batches
- Genetics: Testing if observed offspring ratios match Mendelian expectations
- Social sciences: Testing relationships between categorical variables like education level and political affiliation
Example Calculation
Scenario: Testing if a die is fair using 60 rolls.
Observed: 1→8, 2→12, 3→9, 4→11, 5→10, 6→10
Expected: Each face should appear 10 times (60/6)
Calculation:
- χ² = (8-10)²/10 + (12-10)²/10 + (9-10)²/10 + (11-10)²/10 + (10-10)²/10 + (10-10)²/10
- χ² = 0.4 + 0.4 + 0.1 + 0.1 + 0 + 0 = 1.0
- df = 6 - 1 = 5
- Critical value at α=0.05: 11.070
- Since 1.0 < 11.070, fail to reject H₀ - the die appears fair
Privacy & Limitations
- All calculations run entirely in your browser -- nothing is sent to any server.
- Results are computed using standard formulas and should be verified for critical applications.
Related Tools
- Decimal to Fraction Converter -- Convert decimals to fractions and vice versa
- Distance Formula Calculator -- Calculate distance between two points using the distance formula
- Exponent Calculator -- Calculate powers with negative and fractional exponents
- Scientific Calculator -- Full-featured scientific calculator with trig, logarithms, exponents, and
Related Tools
View all toolsPercentage Calculator
Calculate percentages, find X% of Y, percentage change
Ratio Calculator
Simplify a ratio and see the reduced form
Number to Words Converter
Convert numbers to written English words
Scientific Notation Converter
Convert between standard and scientific notation
Decimal to Fraction Converter
Convert decimals to fractions and vice versa
Quadratic Formula Calculator
Solve ax² + bx + c = 0 with step-by-step solution
Chi-Square Test Calculator FAQ
What is a chi-square test?
A chi-square test is a statistical hypothesis test that examines whether observed frequencies differ significantly from expected frequencies. It tests relationships between categorical variables or checks if sample data fits a theoretical distribution.
When should I use a goodness of fit test?
Use a goodness of fit test when you have one categorical variable and want to test if your observed data matches an expected distribution. For example, testing if a die is fair by comparing observed rolls to expected uniform distribution.
What does the p-value tell me?
The p-value represents the probability of obtaining results as extreme as yours if the null hypothesis is true. A small p-value (typically less than 0.05) suggests you should reject the null hypothesis.
What is degrees of freedom in a chi-square test?
Degrees of freedom (df) represents the number of values free to vary. For goodness of fit, df = categories - 1. For independence tests, df = (rows - 1) times (columns - 1).
What is Cramers V?
Cramers V is an effect size measure for chi-square tests of independence, ranging from 0 to 1. Values of 0.1 indicate a small effect, 0.3 a medium effect, and 0.5 or higher a large effect.
What are the assumptions of the chi-square test?
The main assumptions are independence of observations, random sampling, adequate sample size (generally at least 5 expected observations per cell), and categorical data.