Chi-squared Test for Independence
📖 Scenario: You work in a marketing team. You want to check if customer preference for two different products depends on their age group. You have collected data on how many customers in each age group prefer each product.
🎯 Goal: Build a Python program that uses a chi-squared test to check if product preference depends on age group.
📋 What You'll Learn
Create a contingency table as a dictionary of dictionaries with exact counts
Create a variable for the significance level
Use scipy.stats.chi2_contingency to perform the chi-squared test
Print the chi-squared statistic and p-value
💡 Why This Matters
🌍 Real World
Chi-squared tests are used in marketing, medicine, and social sciences to check if two categorical variables are related.
💼 Career
Data analysts and scientists use chi-squared tests to analyze survey data and customer preferences to make informed decisions.
Progress0 / 4 steps