Chi-Square Test Calculator
Test statistical independence and goodness of fit with the chi-square test.
Chi-Square Goodness of Fit Test
Test if observed frequencies match expected frequencies
Results:
Chi-Square Statistic (χ²):
Degrees of Freedom (df):
Critical Value:
P-value (approx):
| Category | Observed (O) | Expected (E) | (O - E)²/E |
|---|---|---|---|
| χ² Sum: | |||
Example Datasets:
Chi-Square Test of Independence
Test if two categorical variables are independent (2x2 contingency table)
| Column 1 | Column 2 | |
|---|---|---|
| Row 1 | ||
| Row 2 |
Results:
Chi-Square Statistic (χ²):
Degrees of Freedom (df):
Critical Value:
P-value (approx):
Expected Frequencies:
| Column 1 | Column 2 | Row Total |
|---|
Example Datasets:
Chi-Square Critical Value Lookup
Find the critical value for a given degrees of freedom and significance level
Critical Value:
Reject null hypothesis if χ² > critical value
Chi-Square Distribution Table (α = 0.05):
| df | α = 0.10 | α = 0.05 | α = 0.01 |
|---|
📚 How It Works
What is the Chi-Square Test?
The chi-square (χ²) test is a statistical hypothesis test used to determine if there's a significant difference between observed and expected frequencies, or if two categorical variables are independent.
Chi-Square Formula
χ² = Σ [(O - E)² / E]
Where:
- O = Observed frequency
- E = Expected frequency
- Σ = Sum over all categories
Goodness of Fit Test
Tests if observed data fits an expected distribution:
- Null Hypothesis (H₀): Observed data fits expected distribution
- Alternative (H₁): Observed data doesn't fit expected distribution
- Degrees of Freedom: df = k - 1 (where k = number of categories)
Example: Is a die fair? Roll 60 times, expect 10 per face.
Test of Independence
Tests if two categorical variables are independent:
- Null Hypothesis (H₀): Variables are independent
- Alternative (H₁): Variables are dependent (associated)
- Degrees of Freedom: df = (rows - 1) × (columns - 1)
Example: Is gender associated with product preference?
Expected Frequencies (Independence)
For a contingency table:
E = (Row Total × Column Total) / Grand Total
Interpreting Results
- Calculate χ²: Sum of [(O-E)²/E] for all cells
- Find df: Degrees of freedom
- Compare: χ² statistic vs. critical value
- Decision:
- If χ² > critical value: Reject H₀ (significant difference)
- If χ² ≤ critical value: Fail to reject H₀ (no significant difference)
Significance Levels
- α = 0.05 (5%): Standard in most fields
- α = 0.01 (1%): More stringent (reduce Type I error)
- α = 0.10 (10%): More lenient (exploratory research)
P-Value Interpretation
- p < 0.001: Very strong evidence against H₀
- p < 0.01: Strong evidence against H₀
- p < 0.05: Moderate evidence against H₀
- p > 0.05: Weak evidence, fail to reject H₀
Assumptions
- Data are frequencies (counts), not percentages
- All observations are independent
- Expected frequency in each cell should be ≥ 5
- Sample is random
Real-World Applications
- Genetics: Test Mendelian inheritance ratios (3:1)
- Medicine: Treatment effectiveness vs. outcomes
- Marketing: Product preference by demographic
- Quality Control: Defect rates across shifts
- Social Science: Survey response patterns
- Gaming: Testing if dice/cards are fair
Example Calculation
Question: Is a die fair? Rolled 60 times:
| Face | Observed | Expected | (O-E)²/E |
|---|---|---|---|
| 1 | 8 | 10 | 0.4 |
| 2 | 12 | 10 | 0.4 |
| 3 | 11 | 10 | 0.1 |
| 4 | 9 | 10 | 0.1 |
| 5 | 10 | 10 | 0.0 |
| 6 | 10 | 10 | 0.0 |
| χ² = | 1.0 | ||
df = 6 - 1 = 5, critical value (α=0.05) = 11.07
Conclusion: χ² (1.0) < 11.07, fail to reject H₀. Die appears fair.
🔗 Related Utils
Feedback
Help us improve this page by providing feedback, and include your name/email if you want us to reach back. Thank you in advance.
Sending...
Feedback sent. Thank you!
Error occurred!
-
-
-
-
-
-
-
- ABI Encoder / Decoder
- Block Estimator
- Calldata Cost
- CREATE2 Address
- ENS Availability
- ENS Cost Estimator
- ENS Lookup
- ENS Namehash
- ENS Record Viewer
- ENS Subname Explorer
- ERC-20 Unit Converter
- Gas Estimator
- HD Wallet Derivation
- Merkle Tree Visualizer
- 4-Byte Selector Lookup
- Solidity Storage Layout
- Transaction Decoder
- Vanity Address Estimator
- Wallet Address Validator
- Wei/Gwei/Ether Converter
-
-
-
-
-
- API Response
- ASCII Table
- Code Bug Detector
- Code Explanation
- CSS Beautifier
- Env Parser
- GraphQL Query
- Syntax Highlight
- HTML Beautifier
- JS Beautifier
- JSON Formatter
- JSONPath
- JWT Decoder
- JS keyCodes
- API Lorem Ipsum
- RegExp
- Regex Library
- Semver Compare
- SQL Beautifier
- TOML Formatter
- Code Unminifier
- XML Beautifier
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Amortization
- Break-Even
- Compound Interest
- Crypto Profit/Loss
- Debt Payoff
- Discount
- Effective Interest
- Emergency Fund
- Inflation Calculator
- Simple Interest
- Invoice Calculator
- IRR Calculator
- Mortgage
- NPV Calculator
- Portfolio
- Profit Margin
- Rent vs Buy
- Retirement Calc
- ROI Calculator
- Salary vs Hourly
- Savings Goal
- Tax Calculator
- VAT
-
-
-
-
-
-
-
-
-
-
-
-
- Equation Solver
- Exponent Calculator
- Factorial Calculator
- Fibonacci Sequence
- Fraction Calculator
- Fraction Simplifier
- GCD Calculator
- GCD/LCM
- Least Common Multiple (LCM) Calculator
- Logarithm Calculator
- Magic Square
- Matrix Calculator
- Number Base Converter
- Pascal's Triangle
- PDE Solver
- Prime Checker
- Prime Factorization
- Roman Numbers
- Scientific Notation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Broken Link Checker
- Canonical URL Checker
- Core Web Vitals Checker
- Favicon
- Heading Structure
- Keyword Density
- Meta Tags
- Mobile-Friendly Test
- Open Graph Tags
- Page Load Time Analyzer
- Redirect Checker
- robots.txt
- Schema Markup
- SEO Optimized Checklist
- XML Sitemap
- Time on Page Tracker
- Page Title & Desc.
- Twitter Card Generator
-
-
-
-
-
-
- Acceleration
- Substance Amount
- Angle
- Area
- Astronomical
- Base Converter
- Capacitance
- Electric Charge
- Data Transfer
- Data Storage
- Density
- Energy Converter
- Force Converter
- Frequency Converter
- Fuel Economy
- Illuminance
- Inductance
- Length / Distance
- Power
- Pressure
- Electrical Resistance
- Time
- Speed
- Temperature
- Viscosity
- Volume
- Weight
-
-
-
-
-