Activity 34

MATH 216: Statistical Thinking

Activity 1: Quiz

Question: “Given the following contingency table, what is the expected count for the cell (Flu, One Shot) if the null hypothesis of independence is true?”

Status No Vaccine One Shot Two Shot Total
Flu 24 9 13 46
No Flu 289 100 565 954
Total 313 109 578 1000

Options:

    1. 5.0
    1. 4.5
    1. 5.5
    1. 6.0

Activity 2: Data Exploration

  1. Load the Data: Use RStudio to load the dataset provided below.
  2. Create a Contingency Table: Generate a contingency table using the table() function.
  3. Visualize the Data: Create a bar plot or mosaic plot to visualize the relationship between the variables.

Dataset:

No Vaccine One Shot Two Shot Sum
flu 24 9 13 46
no_flu 289 100 565 954
Sum 313 109 578 1000

    Pearson's Chi-squared test

data:  tab1
X-squared = 17.313, df = 2, p-value = 0.000174
Expected Counts
       No Vaccine One Shot Two Shot
flu        14.398    5.014   26.588
no_flu    298.602  103.986  551.412

Activity 3: Group Activities with Real Data

  1. Analyze the Data: Use the provided dataset to perform a Chi-Square test for independence.
  2. Interpret the Results: Discuss the results of the Chi-Square test. What does the p-value tell you about the relationship between the variables?
Republican Democrat Independent Sum
strong 8 10 12 30
moderate 12 17 6 35
weak 10 13 12 35
Sum 30 40 30 100

    Pearson's Chi-squared test

data:  tab2
X-squared = 4.5397, df = 4, p-value = 0.3379
Expected Counts
          Republican Democrat Independent
strong           9.0       12         9.0
moderate        10.5       14        10.5
weak            10.5       14        10.5