10.3 Test of Independence

Aligned outcomes:

SLO 4

Demonstrate an understanding of, and ability to use, basic ideas of statistical processes, including hypothesis tests and confidence interval estimation.

SLO 5

Identify appropriate statistical techniques and use technology-based statistical analysis to describe, interpret, and communicate results.

Learning Objectives

By the end of this section, you will be able to:

In this section, you will learn to:
  • state the null and alternative hypotheses for a test of independence, in words;
  • compute an expected cell count from a contingency table using the row total, the column total, and the sample size;
  • find the degrees of freedom for a test of independence from the number of rows and columns;
  • carry a test of independence through to a decision and write the conclusion in context.

Section 10.2 tested one list of counts against a claimed distribution. This section tests something subtler and more common: two characteristics recorded on the same people, laid out in a grid. Do community college students, four-year students and nonstudents volunteer for different lengths of time, or does the pattern of hours look the same whoever you ask? Is a student's anxiety level connected to their need to succeed, or are those two things unrelated? The arithmetic will look almost identical to the last section. What changes is where the expected counts come from — and that is the whole idea of the test.

10.3.1 What Independence Means in a Table

Tests of independence involve using a contingency table of observed (data) values — a grid whose rows are the categories of one factor and whose columns are the categories of another.

Definition 10.3.1: Test of Independence

A test of independence determines whether two factors recorded on the same individuals are independent of each other.

You first encountered the term independence in Probability Topics: two events \(A\) and \(B\) are independent when

$$ P(A \text{ AND } B) = P(A)P(B) $$

That equation is the entire engine of this test. If two factors really are unrelated, then the share of people landing in any particular cell of the table should be the product of the two margins — the share in that row times the share in that column. The test builds the whole table of counts that equation predicts, then measures how far the real table sits from it.

In a test of independence we state the null and alternative hypotheses in words. Since the contingency table consists of two factors, the null hypothesis states that the factors are independent and the alternative states that they are not independent, meaning dependent.

The expected value for each cell needs to be at least five

This is the same condition as in Section 10.2 and it is checked the same way — cell by cell, on the expected counts, never the observed ones. In a contingency table the cells that fail are usually in a sparse row or a sparse column, and the repair is the same: merge that category into an adjacent one before computing anything else.

Definition 10.3.1 — Test of Independence A contingency table of volunteer hours by student type (Table 10.3.2) with one cell highlighted. The cell's row total (255) and column total (298) are tagged in the accent color, matching the same-colored numbers in the expected-count note below: expected = (row total × column total) / grand total = (255 × 298) / 839 ≈ 90.6, against the observed 111. On the right, cards state the hypotheses in words: H₀ says the two factors are independent, Hₐ says they are dependent. Test of Independence does the observed table match what independence predicts? Type of Volunteer 1–3 h 4–6 h 7–9 h Total College students 111 96 48 255 Four-year students 96 133 61 290 Nonstudents 91 150 53 294 Column total 298 379 162 839 row total column total Highlighted cell under independence: expected = (row total × column total) / grand total 255 × 298) / 839 ≈ 90.6   observed: 111 H₀ the factors are independent Hₐ the factors are dependent the test builds the whole table independence predicts, then measures how far the real table sits from it

Definition 10.3.1 — Test of Independence: A contingency table of volunteer hours by student type (Table 10.3.2) with one cell highlighted.

10.3.2 The Expected Count Formula

Working the independence equation through for a single cell gives a formula you can apply directly.

Example 10.3.1: Speeding violations and cell phone use

Suppose \(A\) = a speeding violation in the last year and \(B\) = a cell phone user while driving. In a study of drivers, 755 people were surveyed. Out of the 755, 70 had a speeding violation and 685 did not; 305 used cell phones while driving and 450 did not. If \(A\) and \(B\) are independent, how many drivers would you expect to have both used a cell phone while driving and received a speeding violation?

Solution — deriving the expected count from the independence rule

Step 1 — Name the unknown. Let \(y\) = the expected number of drivers who used a cell phone while driving and received a speeding violation. "A AND B" is the event that a driver received a speeding violation last year and also used a cell phone while driving.

Step 2 — Write the independence condition. If \(A\) and \(B\) are independent, then \(P(A \text{ AND } B) = P(A)P(B)\). Each probability is a count over the total surveyed:

$$ \frac{y}{755} = \left(\frac{70}{755}\right)\left(\frac{305}{755}\right) $$

Step 3 — Solve for \(y\). Multiply both sides by 755. One factor of 755 cancels:

$$ y = \frac{(70)(305)}{755} = 28.3 $$

Step 4 — Say what it means. About 28 people from the sample are expected to use cell phones while driving and to receive speeding violations.

Answer: About 28 drivers, from \(y = \frac{(70)(305)}{755} = 28.3\).

Look at what Step 3 left behind. The 70 is the total for the "speeding violation" row, the 305 is the total for the "cell phone user" column, and the 755 is everyone surveyed. That is a general result, not a one-off:

Definition 10.3.2: Expected Cell Count

For a test of independence, the expected number in any cell is

$$ E = \frac{(\text{row total})(\text{column total})}{\text{total number surveyed}} $$

This is the formula that makes a contingency table testable. The observed counts come from the data; every expected count comes from the margins.

If we do a test of independence on the driver study, the null hypothesis is:

\(H_{0}\): Being a cell phone user while driving and receiving a speeding violation are independent events.

If the null hypothesis were true, we would expect about 28 people to use cell phones while driving and to receive a speeding violation.

Definition 10.3.2 — Expected Cell Count A 3-by-3 contingency table of volunteer hours from Table 10.3.2, with row totals, column totals, and the grand total emphasised. One cell — community college students working 1–3 hours — is highlighted, along with its row total (255) and its column total (298). To the right, the expected-count formula E = (row total)(column total) / total surveyed is shown with that cell's numbers substituted: E = (255)(298)/839 ≈ 90.6. Type of Volunteer 1–3 h 4–6 h 7–9 h Row total Community college students Four-year college students Nonstudents Column total 111 96 48 96 133 61 91 150 53 255 290 294 298 379 162 839 Table 10.3.2 — observed volunteer hours (n = 839) Expected count in any cell: E = (row total)(column total) total surveyed E = (255)(298) 839 90.6 The observed count comes from the data; every expected count comes from the margins.

Definition 10.3.2 — Expected Cell Count: A 3-by-3 contingency table of volunteer hours from Table 10.3.2, with row totals, column totals, and the grand total emphasised.

Try It Now 10.3.1

A sample of 300 students is taken. Of the students surveyed, 50 were music students, while 250 were not. Ninety-seven were on the honor roll, while 203 were not. If we assume being a music student and being on the honor roll are independent events, what is the expected number of music students who are also on the honor roll?

Solution — applying the expected-count formula

Step 1 — Identify the row total. Being a music student is one factor; 50 students are music students.

Step 2 — Identify the column total. Being on the honor roll is the other factor; 97 students are on the honor roll.

Step 3 — Identify the total surveyed. The sample size is 300.

Step 4 — Apply the formula.

$$ E = \frac{(\text{row total})(\text{column total})}{\text{total number surveyed}} = \frac{(50)(97)}{300} = 16.17 $$

Answer: About 16 students are expected to be both music students and on the honor roll.

10.3.3 The Statistic and Its Degrees of Freedom

The test statistic for a test of independence is similar to that of a goodness-of-fit test.

Definition 10.3.3: Chi-Square Test Statistic for Independence
$$ \sum_{(i \cdot j)} \frac{(O - E)^{2}}{E} $$

where

  • \(O\) = observed values;
  • \(E\) = expected values;
  • \(i\) = the number of rows in the table;
  • \(j\) = the number of columns in the table.

There are \(i \cdot j\) terms of the form \(\frac{(O - E)^{2}}{E}\), one for every cell in the grid.

Definition 10.3.3 — Chi-Square Test Statistic for Independence A static concept figure. On the left, the volunteer-hours contingency table from Table 10.3.2: three volunteer types (community college students, four-year college students, nonstudents) crossed with three weekly-hours bins (1–3, 4–6, 7–9). Each of the nine body cells shows its observed count O and, beneath it in accent color, that cell's own contribution (O − E)²/E computed against the expected counts from the row and column totals. A legend beneath the table explains the accent values. On the right, the definition's summation formula, then the nine per-cell terms listed in reading order, then a rule and the total chi-square statistic ≈ 12.99. An arrow runs from the table to the formula, showing that the statistic is built cell by cell. One term per cell, summed over the whole grid Volunteer type 1–3 hrs 4–6 hrs 7–9 hrs Community college students Four-year college students Nonstudents 111 4.61 96 3.20 48 0.03 96 0.48 133 0.03 61 0.45 91 1.73 150 2.23 53 0.25 Accent value in each cell = that cell's own (O − E)²/E Observed counts O from Table 10.3.2; E from row and column totals χ² = i·j (O − E)² E one term for every cell 4.61 3.20 0.03 0.48 0.03 0.45 1.73 2.23 0.25 students · 1–3 hrs students · 4–6 hrs students · 7–9 hrs four-year · 1–3 hrs four-year · 4–6 hrs four-year · 7–9 hrs nonstudents · 1–3 hrs nonstudents · 4–6 hrs nonstudents · 7–9 hrs χ² ≈ 12.99 a large value means O and E disagree

Definition 10.3.3 — Chi-Square Test Statistic for Independence: Observed counts O from Table 10.3.2; E from row and column totals.

Definition 10.3.4: Degrees of Freedom for a Test of Independence
$$ df = (\text{number of columns} - 1)(\text{number of rows} - 1) $$

The test of independence is always right-tailed, for the same reason the goodness-of-fit test is. If the expected and observed values are not close together, the test statistic gets very large and lands way out in the right tail of the chi-square curve.

Why the degrees of freedom is a product

Once you know the row totals and the column totals, most of the table is already determined. In a 3-by-3 table you may fill in the top-left 2-by-2 block freely, and every remaining cell is then forced by the margins. Two free choices across, two down, so \(df = 2 \times 2 = 4\). The formula is counting exactly that freedom, which is why it multiplies rather than adds — and why it never involves the sample size.

Definition 10.3.4 — Degrees of Freedom for a Test of Independence A 3-by-3 contingency table built from Table 10.3.2 (volunteer type by hours worked per week). The four interior cells in the top-left 2-by-2 block are highlighted as the free choices; the five remaining interior cells are shown as forced once the row totals and column totals are known. To the right, the computation df = (columns − 1)(rows − 1) = 2 × 2 = 4 is written out. df = (columns − 1)(rows − 1) 1–3 h 4–6 h 7–9 h CC stud. 4-yr stud. Nonstud. free free free free forced forced forced forced forced free choices (fill these first) forced by the margins From Table 10.3.2: 3 columns, 3 rows df = (3 − 1)(3 − 1)     = 2 × 2 = 4 Two free choices across, two down — the product counts exactly that freedom. the 2 × 2 free block

Definition 10.3.4 — Degrees of Freedom for a Test of Independence: A 3-by-3 contingency table built from Table 10.3.2 (volunteer type by hours worked per week).

10.3.4 A Full Test of Independence

Try It Now 10.3.2

The Bureau of Labor Statistics gathers data about employment in the United States. A sample is taken to calculate the number of U.S. citizens working in one of several industry sectors over time, with the results in Table 10.3.1. We want to know if the change in the number of jobs is independent of the change in years. State the null and alternative hypotheses and the degrees of freedom.

Table 10.3.1 — U.S. employment by industry sector and year (thousands).
Industry Sector200020102020Total
Nonagriculture wage and salary13,24313,04415,01841,305
Goods-producing, excluding agriculture2,4571,7711,9506,178
Services-providing10,78611,27313,06835,127
Agriculture, forestry, fishing, and hunting240214201655
Nonagriculture self-employed and unpaid family worker9318949722,797
Secondary wage and salary jobs in agriculture and private household industries14111136
Secondary jobs as a self-employed or unpaid family worker196144152492
Total27,86727,35131,37286,590
Solution — hypotheses and degrees of freedom for the employment table

Step 1 — Name the two factors. The factors are the industry sector and the year.

Step 2 — Write the null hypothesis. \(H_{0}\): The number of jobs is independent of the year.

Step 3 — Write the alternative. \(H_{a}\): The number of jobs is dependent on the year.

Step 4 — Count the rows and columns of data. The table has 7 industry-sector rows and 3 year columns. The Total row and Total column are margins, not categories, and are never counted.

Step 5 — Apply the formula.

$$ df = (\text{number of columns} - 1)(\text{number of rows} - 1) = (3 - 1)(7 - 1) = (2)(6) = 12 $$

Answer: \(H_{0}\): jobs are independent of year; \(H_{a}\): jobs are dependent on year; \(df = 12\).

Example 10.3.2: Volunteer hours and volunteer type

In a volunteer group, adults 21 and older volunteer from one to nine hours each week to spend time with a disabled senior citizen. The program recruits among community college students, four-year college students, and nonstudents. Table 10.3.2 is a sample of the adult volunteers and the number of hours they volunteer per week. Is the number of hours volunteered independent of the type of volunteer?

Table 10.3.2 — Number of hours worked per week by volunteer type (observed).
Type of Volunteer1–3 Hours4–6 Hours7–9 HoursRow Total
Community College Students1119648255
Four-Year College Students9613361290
Nonstudents9115053294
Column Total298379162839
Solution — a complete test, from margins to conclusion

Step 1 — Identify the test. The observed table and the question "Is the number of hours volunteered independent of the type of volunteer?" tell you this is a test of independence. The two factors are number of hours volunteered and type of volunteer. This test is always right-tailed.

Step 2 — State the hypotheses.

\(H_{0}\): The number of hours volunteered is independent of the type of volunteer.

\(H_{a}\): The number of hours volunteered is dependent on the type of volunteer.

Step 3 — Build the expected table. Each expected count is \(\frac{(\text{row total})(\text{column total})}{\text{total surveyed}}\). For the top left cell,

$$ E = \frac{(\text{row total})(\text{column total})}{\text{total number surveyed}} = \frac{(255)(298)}{839} = 90.57 $$

Repeating that for every cell gives Table 10.3.3.

Table 10.3.3 — Number of hours worked per week by volunteer type (expected).
Type of Volunteer1–3 Hours4–6 Hours7–9 Hours
Community College Students90.57115.1949.24
Four-Year College Students103.00131.0056.00
Nonstudents104.42132.8156.77

Step 4 — Check the condition. The smallest expected count is 49.24, far above five.

Step 5 — Calculate the test statistic. Summing \(\frac{(O-E)^{2}}{E}\) across all nine cells gives \(\chi^{2} = 12.99\).

Step 6 — Name the distribution and the degrees of freedom. The distribution for the test is \(\chi_{4}^{2}\), where

$$ df = (3 \text{ columns} - 1)(3 \text{ rows} - 1) = (2)(2) = 4 $$

Step 7 — Find the p-value. \(p\text{-value} = P(\chi^{2} > 12.99) = 0.0113\).

Step 8 — Compare \(\alpha\) and the p-value. Since no \(\alpha\) is given, assume \(\alpha = 0.05\). The p-value is 0.0113, so \(\alpha >\) p-value.

Step 9 — Make a decision. Since \(\alpha >\) p-value, reject \(H_{0}\). This means that the factors are not independent.

Answer: \(\chi^{2} = 12.99\) with \(df = 4\) and a p-value of 0.0113. At a 5% level of significance, from the data, there is sufficient evidence to conclude that the number of hours volunteered and the type of volunteer are dependent on one another.

Where the dependence actually lives

Rejecting \(H_{0}\) says the two factors are related; it does not say how. Comparing Table 10.3.2 against Table 10.3.3 answers that. Community college students volunteered 111 short shifts where 90.57 were expected and 96 medium shifts where 115.19 were expected — they are concentrated in the 1–3 hour band. Nonstudents run the other way, 150 medium shifts against 132.81 expected. The statistic found the pattern; only the two tables side by side describe it.

For the example in Table 10.3.2, if there had been another type of volunteer — teenagers — the table would have four rows instead of three, and the degrees of freedom would be \((3 - 1)(4 - 1) = 6\).

Using the TI-83, 83+, 84, 84+ Calculator

Press the MATRIX key and arrow over to EDIT. Press 1: [A]. Press 3 ENTER 3 ENTER to size the matrix, then enter the table values by row from Table 10.3.2, pressing ENTER after each. Press 2nd QUIT. Press STAT, arrow over to TESTS, arrow down to C: χ²-TEST and press ENTER. You should see Observed: [A] and Expected: [B]. If necessary, move the cursor after Observed:, press 2nd MATRIX and press 1: [A] to select matrix A. It is not necessary to enter expected values — the matrix listed after Expected: can be blank, because the calculator computes it from the margins itself. Arrow down to Calculate and press ENTER. The test statistic is 12.9909 and the p-value is 0.0113. Run it a second time, choosing Draw instead of Calculate, to see the shaded right tail.

10.3.5 Reading Expected Counts Out of a Larger Table

The formula does not care how big the grid is. This example applies it twice to a 3-by-5 table, once for a busy cell and once for a sparse one.

Try It Now 10.3.3

Refer back to the information in Try It Now 10.3.2. How many services-providing jobs are there expected to be in 2020? How many nonagriculture wage and salary jobs are there expected to be in 2020?

Solution — two cells from the same margins

Step 1 — Collect what both cells share. Both are in the 2020 column, whose column total is 31,372, and the total surveyed is 86,590.

Step 2 — Compute the services-providing cell. Its row total is 35,127.

$$ E = \frac{(35{,}127)(31{,}372)}{86{,}590} \approx 12{,}726.69 $$

Step 3 — Compute the nonagriculture wage and salary cell. Its row total is 41,305.

$$ E = \frac{(41{,}305)(31{,}372)}{86{,}590} \approx 14{,}965.01 $$

Answer: About 12,727 services-providing jobs and about 14,965 nonagriculture wage and salary jobs are expected in 2020.

Example 10.3.3: Anxiety level and the need to succeed

De Anza College is interested in the relationship between anxiety level and the need to succeed in school. A random sample of 400 students took a test that measured anxiety level and need to succeed in school, with the results in Table 10.3.4. De Anza College wants to know if anxiety level and need to succeed in school are independent events.

Table 10.3.4 — Need to succeed in school vs. anxiety level.
Need to Succeed in SchoolHigh AnxietyMed-high AnxietyMedium AnxietyMed-low AnxietyLow AnxietyRow Total
High Need3542531510155
Medium Need1848633331193
Low Need4511151752
Column Total57951276358400

a. How many high anxiety level students are expected to have a high need to succeed in school?

b. If the two variables are independent, how many students do you expect to have a low need to succeed in school and a med-low level of anxiety?

Solution — picking the right row total and column total

Step 1 — Locate the margins for part a. The column total for a high anxiety level is 57. The row total for a high need to succeed in school is 155. The sample size or total surveyed is 400.

Step 2 — Apply the formula for part a.

$$ E = \frac{(\text{row total})(\text{column total})}{\text{total surveyed}} = \frac{155 \cdot 57}{400} = 22.09 $$

The expected number of students who have a high anxiety level and a high need to succeed in school is about 22.

Step 3 — Locate the margins for part b. The column total for a med-low anxiety level is 63. The row total for a low need to succeed in school is 52. The total surveyed is again 400.

Step 4 — Apply the formula for part b.

$$ E = \frac{(\text{row total})(\text{column total})}{\text{total surveyed}} = \frac{52 \cdot 63}{400} = 8.19 $$

The expected number of students who have a low need to succeed in school and a med-low level of anxiety is 8.

Answer: (a) about 22 students; (b) about 8 students.

8.19 is a warning, not just an answer

Part b produced an expected count of 8.19 — legal, since the condition asks only for five, but close enough to the floor to be worth noticing. In a table this wide the sparse corners are where the condition fails first, and the Low Need row is thin across the board. If one more cell in that row dipped under five, the honest repair would be to merge Low Need into Medium Need before running the test at all.

Problem Set 10.3

Problem 1. State the null and alternative hypotheses for a test of independence, in words.

Solution

Step 1 — State the null hypothesis in words: The null hypothesis always asserts no relationship between the two factors.

\(H_{0}\): The two factors are independent (there is no association between them).

Step 2 — State the alternative hypothesis in words: The alternative is the complement of independence, i.e., dependence.

\(H_{a}\): The two factors are dependent (not independent; there is an association between them).

Answer: \(H_{0}\): the two factors are independent; \(H_{a}\): the two factors are dependent (not independent).

Problem 2. Write the formula for the expected count of a cell in a contingency table.

Solution

Step 1 — Recall where the formula comes from: If two factors are independent, then \(P(A \text{ AND } B) = P(A)P(B)\), so a cell's expected share equals the row's share times the column's share of the sample.

Step 2 — Write the formula:

$$ E = \frac{(\text{row total})(\text{column total})}{\text{total number surveyed}} $$

Answer: \(E = \dfrac{(\text{row total})(\text{column total})}{\text{total number surveyed}}\).

Problem 3. A contingency table has 4 rows and 6 columns. What is the number of degrees of freedom?

Solution

Step 1 — Identify rows and columns: The table has 4 rows and 6 columns. Margins (totals) are not counted as categories.

Step 2 — Apply the degrees-of-freedom formula:

$$ df = (\text{number of columns} - 1)(\text{number of rows} - 1) = (6-1)(4-1) = (5)(3) = 15 $$

Answer: \(df = 15\).

Problem 4. A student computes \(df\) for a 3-by-4 table as \(3 \times 4 - 1 = 11\). Explain the error and give the correct value.

Solution

Step 1 — Identify the error: The student multiplied the full counts of rows and columns and subtracted 1 only once. Degrees of freedom count how many cells can be filled freely once all margins are fixed — one free choice per column direction and one per row direction, so each factor loses exactly one degree.

Step 2 — Apply the correct formula:

$$ df = (\text{number of columns} - 1)(\text{number of rows} - 1) = (4-1)(3-1) = (3)(2) = 6 $$

Answer: The error was computing \(3 \times 4 - 1\) instead of \((4-1)(3-1)\). The correct value is \(df = 6\).

Problem 5. In a survey of 500 people, the row total for a category is 120 and the column total is 200. Find the expected count for that cell.

Solution

Step 1 — Identify the three ingredients: Row total = 120, column total = 200, total surveyed = 500.

Step 2 — Apply the expected-count formula:

$$ E = \frac{(\text{row total})(\text{column total})}{\text{total number surveyed}} = \frac{(120)(200)}{500} = \frac{24{,}000}{500} = 48 $$

Answer: The expected count for that cell is 48 people.

Problem 6. Explain why a test of independence is always right-tailed.

Solution

Step 1 — Recall what large values of the statistic mean: The test statistic is \(\sum \frac{(O-E)^{2}}{E}\). It measures how far the observed table sits from the table predicted by independence. If the factors really are independent, observed counts land close to expected counts, so each term \(\frac{(O-E)^{2}}{E}\) stays small.

Step 2 — Explain why deviations push the statistic right: Any departure from independence makes some \((O-E)^{2}\) terms large, inflating the statistic toward larger values. Small values only occur when the data fit independence well, which supports \(H_{0}\), not \(H_{a}\).

Step 3 — Conclude the tail behavior: Since only large values of \(\chi^{2}\) give evidence against \(H_{0}\), the p-value is computed as \(P(\chi^{2} > \text{observed value})\) — a right-tail probability.

Answer: A test of independence is always right-tailed because only unusually large values of \(\chi^{2}\) indicate that observed and expected counts disagree strongly enough to suggest dependence; agreement with \(H_{0}\) produces small statistics near zero.

Problem 7. A test of independence on a 2-by-3 table gives \(\chi^{2} = 9.8\). State the degrees of freedom, and say whether a p-value of 0.0074 leads you to reject \(H_{0}\) at the 5% significance level.

Solution

Step 1 — Compute the degrees of freedom: A 2-by-3 table has 2 rows and 3 columns:

$$ df = (\text{columns} - 1)(\text{rows} - 1) = (3-1)(2-1) = (2)(1) = 2 $$

Step 2 — Compare the p-value to \(\alpha\): With \(\alpha = 0.05\) and p-value = 0.0074, we have p-value < \(\alpha\).

Step 3 — Make the decision: When the p-value is less than \(\alpha\), reject \(H_{0}\); the data provide sufficient evidence that the two factors are dependent.

Answer: \(df = 2\). Since 0.0074 < 0.05, reject \(H_{0}\) at the 5% significance level.

Problem 8. A contingency table has an expected count of 3.4 in one cell. State what must be done before the test can be run, and what it does to the degrees of freedom.

Solution

Step 1 — State the required condition: Every expected cell count must be at least five. An expected count of 3.4 violates this condition, so the test cannot be run on this table as it stands.

Step 2 — Describe the repair: Merge the sparse category (the row or column containing the small cell) into an adjacent category, combining their counts, before computing anything else. This raises every expected count above five.

Step 3 — Describe the effect on degrees of freedom: Merging removes one row or one column from the table, so the corresponding factor contributes one fewer degree of freedom. For example, merging two rows changes \(df\) from \((c-1)(r-1)\) to \((c-1)(r-2)\), reducing it by \((c-1)\).

Answer: The sparse category must be merged into an adjacent one so all expected counts reach at least five; this reduces the table's dimensions by one row or column and therefore lowers the degrees of freedom accordingly.

Problem 9. Explain why the expected counts are computed from the row and column totals rather than from the observed cell counts.

Solution

Step 1 — Recall what the expected counts represent: The expected counts are the counts we would see if \(H_{0}\) were true — if the two factors were independent. They serve as the baseline against which the observed data are compared.

Step 2 — Explain why the cell's own observed count cannot be used: Using the observed cell count would make \((O - E)^{2} = 0\) for that cell, guaranteeing the test finds "no deviation" there regardless of the data. The test would be circular and could never detect dependence.

Step 3 — Explain why the margins are the right source: Under independence, \(P(A \text{ AND } B) = P(A)P(B)\), so the expected share of a cell is the product of the row's share and the column's share. The row and column totals estimate those marginal probabilities, so multiplying them and dividing by the sample size gives the count independence predicts — using information from the whole table, not just the single cell.

Answer: Expected counts must come from the margins because they encode what independence predicts for each cell; building them from the observed cell itself would force \(O = E\) and make the test unable to detect any dependence.

Problem 10. A test of independence rejects \(H_{0}\). Explain what the test has, and has not, established about the two factors.

Solution

Step 1 — State what the test has established: Rejecting \(H_{0}\) provides sufficient evidence, at the chosen significance level, that the two factors are dependent — that is, some association exists between them in the population sampled.

Step 2 — State what the test has NOT established: The test does not show how the factors are related (which cells are higher or lower than expected), does not measure the strength of the association, and — because it is based on observational contingency-table data — does not establish that one factor causes the other. Dependence is not causation.

Answer: The test has established that the two factors are associated (dependent); it has not established the nature, direction, strength, or cause of that relationship — in particular, it has not shown that one factor causes the other.

Key Terms

test of independence — a chi-square test that decides whether two factors recorded on the same individuals are independent of each other.

contingency table — a grid of observed counts whose rows are the categories of one factor and whose columns are the categories of another.

expected cell count — \(\frac{(\text{row total})(\text{column total})}{\text{total number surveyed}}\); the count a cell would hold if the two factors were independent.

row total / column total — the margins of a contingency table; every expected count is built from them, never from the observed count of the cell itself.

degrees of freedom for independence — \((\text{number of columns} - 1)(\text{number of rows} - 1)\); it counts the cells that are free once the margins are fixed, and never involves the sample size.

dependent factors — the conclusion when \(H_{0}\) is rejected: the two factors are related, though the test alone does not say in which direction.