Sign in to jmaths to print this page or save it as a PDF: jmaths-8ce638778fd6.herokuapp.com/maths/ai-sl/hypothesis-testing/13-4-4/problems/

jmaths

IB Mathematics: Applications and Interpretation SL · 13.4: Hypothesis Testing · 13.4.4

Chi-squared test for independence Problem set A Worked solutions

Skills

  1. A survey asks 237 students how they usually travel to school and which year group they are in. The results are shown. A chi-squared test for independence is carried out.

    TravelYear 9Year 10Year 11Walk312418Cycle122025Bus271914Car91622
    1. (a) State the null and alternative hypotheses.

      • H0: the way a student travels to school is independent of year group
      • H1: the way a student travels to school is not independent of year group
    2. (b) Find the number of degrees of freedom.

      • 4 rows and 3 columns: df = (4 − 1)(3 − 1) = 6
  2. The table shows the sport chosen by 154 pupils. If the sport chosen is independent of gender, find the expected frequency of girls who chose tennis.

    SportBoysGirlsTotalHockey342155Tennis193857Swimming271542Total8074154
    • Row total = 57, column total = 74, grand total = 154
    • E = 57 × 74 ÷ 154
    • E = 27.4
  3. Find the degrees of freedom for a chi-squared test for independence on a contingency table with: (a) 5 rows and 3 columns; (b) 2 rows and 6 columns; (c) 4 rows and 4 columns.

    • (a) df = (5 − 1)(3 − 1) = 8
    • (b) df = (2 − 1)(6 − 1) = 5
    • (c) df = (4 − 1)(4 − 1) = 9
  4. A teacher records how often 175 students hand in homework on time, by gender. Use your calculator to find the expected frequencies, \(\chi^2\), the p-value and the degrees of freedom for a test of independence.

    HomeworkAlwaysSometimesNeverGirls412816Boys233532
    • Enter the observed table as a matrix
    • Expected frequencies: Girls: 31.1, 30.6, 23.3; Boys: 32.9, 32.4, 24.7
    • From the calculator: χ² = 11.0, p = 0.00401, df = 2
  5. The curve shows the \(\chi^2\) distribution with 5 degrees of freedom. The shaded right tail has area 0.05.

    510150.050.10.15χ²df = 5
    1. (a) Find the critical value.

      • From the calculator: critical value = 11.1
    2. (b) A test gives \(\chi^2=12.4\). Find the p-value.

      • From the calculator: P(χ² > 12.4) = 0.0297
      • 12.4 > 11.1, so the test statistic is inside the shaded tail

In context

  1. A tour company asks 287 customers which type of holiday they chose and which age group they are in. At the 5% significance level, test whether holiday type is independent of age group.

    HolidayUnder 3030 to 55Over 55Beach443125City333522Walking283138
    1. (a) State the hypotheses.

      • H0: holiday type is independent of age group
      • H1: holiday type is not independent of age group
    2. (b) Write down the number of degrees of freedom.

      • 3 rows and 3 columns: df = (3 − 1)(3 − 1) = 4
    3. (c) Use your calculator to find \(\chi^2\) and the p-value.

      • Enter the table as a matrix. From the calculator: χ² = 8.63, p = 0.0711, df = 4
    4. (d) State the conclusion in context.

      • 0.0711 > 0.05, so do not reject H0.
      • There is insufficient evidence, at the 5% significance level, that holiday type is not independent of age group.
  2. A shop records 250 sales of two kinds of phone case, by the colour chosen. Test, at the 5% significance level, whether the case chosen is independent of the colour.

    CaseBlackBlueRedClearHard32452815Soft21384130
    1. (a) Find the value of \(\chi^2\).

      • Enter the table as a matrix. From the calculator: χ² = 9.94, df = 3
    2. (b) The critical value is 7.81. State the conclusion in context.

      • 9.94 > 7.81, so reject H0.
      • There is sufficient evidence, at the 5% significance level, that the case chosen is not independent of the colour chosen.
  3. A gym asks 328 members how many days a week they visit and which membership they hold. The results are shown.

    Membership1 day2 days3 days4 or moreBasic48221510Standard30352528Premium17273833
    1. (a) Find the expected frequencies.

      • Enter the observed matrix. From the calculator, the expected frequencies:
      • Basic: 27.5, 24.3, 22.6, 20.6; Standard: 34.2, 30.2, 28.1, 25.5; Premium: 33.3, 29.5, 27.3, 24.9
    2. (b) Find the cell that adds most to \(\chi^2\), and give its value of \((O-E)^2/E\).

      • (O − E)²/E for each cell: Basic: 15.3, 0.223, 2.55, 5.43; Standard: 0.510, 0.756, 0.334, 0.236; Premium: 7.98, 0.204, 4.15, 2.64
      • The largest is 15.3, for Basic and 1 day
    3. (c) Compare the observed and expected frequencies in that cell. Describe what this shows in context.

      • O = 48, E = 27.5
      • O is above E: there are more observed in the Basic, 1 day cell than independence predicts, so membership type and visits per week look linked here.

Stretch

  1. A doctor records whether 90 patients took a vitamin and whether they caught a cold in winter.

    VitaminColdNo coldTotalTook vitamin242145No vitamin192645Total434790
    1. (a) Find the expected frequency for patients who took the vitamin and caught a cold if the variables are independent.

      • Row total = 45, column total = 43, grand total = 90
      • E = 45 × 43 ÷ 90 = 21.5
    2. (b) State the degrees of freedom. Use your calculator to find \(\chi^2\), then use the critical value 3.84 to state the conclusion in context, at the 5% significance level.

      • df = (2 − 1)(2 − 1) = 1
      • From the calculator: χ² = 1.11
      • 1.11 < 3.84, so do not reject H0.
      • There is insufficient evidence, at the 5% significance level, that catching a cold is not independent of taking the vitamin.
  2. A test of whether favourite music is independent of age group gives a p-value of 0.032.

    1. (a) State the conclusion at the 5% significance level, in context.

      • 0.032 < 0.05, so reject H0.
      • There is sufficient evidence, at the 5% significance level, that favourite music is not independent of age group.
    2. (b) State the conclusion at the 1% significance level, in context.

      • 0.032 > 0.01, so do not reject H0.
      • There is insufficient evidence, at the 1% significance level, that favourite music is not independent of age group.

jmaths.xyz · AI SL · 13.4.4 Chi-squared test for independence