Statistics 2

In-Class Exercise 10

Yu-You Liou

Shih Chien University

2026-09-16

Question 1

Test for Independence

A survey asked 400 commuters about their main mode of transport and their age group.

MRT Bus Scooter
Under 35 78 42 90
35 or over 62 68 60

Test whether mode of transport is independent of age group at \alpha=0.05.

  1. Build the table with matrix(..., nrow = 2, byrow = TRUE).
  2. State H_0 and H_1.
  3. Run chisq.test() and report the test statistic, the degrees of freedom, and the P-value.
  4. State the decision and the conclusion in words.

Question 2

Expected Frequencies by Hand

For the table in Question 1:

  1. Compute the expected frequency of the cell “Under 35 and MRT” using

E=\frac{(\text{row total})(\text{column total})}{\text{grand total}}

  1. Compute that cell’s contribution (O-E)^2/E to the test statistic.
  2. Confirm the full table of expected frequencies with chisq.test(...)$expected.

Question 3

Test for Homogeneity of Proportions

Three branches were asked whether they met their quarterly target.

Branch A Branch B Branch C
Met target 46 38 55
Did not meet 34 42 25
  1. State H_0 and H_1 for a test of homogeneity of proportions.
  2. Run the test at \alpha=0.05.
  3. Explain in one or two sentences how a test of homogeneity differs from a test of independence, even though the computation is the same.