Goodness of Fit Evaluation with SciPy
📖 Scenario: You are a data analyst working with a small dataset of observed counts from a survey. You want to check if these observed counts fit a theoretical expected distribution using a goodness of fit test.
🎯 Goal: Build a Python program that uses SciPy to perform a chi-square goodness of fit test comparing observed data to expected data.
📋 What You'll Learn
Create a list called
observed_counts with exact values [18, 22, 20, 15, 25]Create a list called
expected_counts with exact values [20, 20, 20, 20, 20]Use
scipy.stats.chisquare to perform the goodness of fit testPrint the chi-square statistic and p-value with clear labels
💡 Why This Matters
🌍 Real World
Goodness of fit tests are used in surveys, quality control, and scientific experiments to check if data matches expected patterns.
💼 Career
Data analysts and scientists use these tests to validate models and assumptions about data distributions.
Progress0 / 4 steps