Chi-squared Test in R
📖 Scenario: You are a researcher studying if two categorical variables are related. For example, you want to check if gender and preference for a product are independent.
🎯 Goal: Build a simple R program that creates a contingency table, sets up a significance level, performs a chi-squared test, and prints the test result.
📋 What You'll Learn
Create a contingency table with exact counts
Set a significance level variable
Perform a chi-squared test using the table
Print the test result
💡 Why This Matters
🌍 Real World
Chi-squared tests are used in research to check if two categories are related, like gender and product preference.
💼 Career
Data analysts and scientists use chi-squared tests to analyze survey data and make decisions based on categorical data relationships.
Progress0 / 4 steps