Learning

open
close

Test of Independence

September 9, 2024 | by Bloom Code Studio

Tests of independence involve using a contingency table of observed (data) values.

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

Σ(i⋅j)(O–E)2EΣ(i⋅j)(O–E)2E

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⋅ji⋅j terms of the form (O–E)2E(O–E)2E.

A test of independence determines whether two factors are independent or not. You first encountered the term independence in Independent and Mutually Exclusive Events earlier. As a review, consider the following example.

NOTE

The expected value inside each cell needs to be at least five in order for you to use this test.

Example 11.8

Suppose A = a speeding violation in the last year and B = a cell phone user while driving. If A and B are independent then P(A ∩∩ B) = P(A)P(B). A ∩∩ B is the event that a driver received a speeding violation last year and also used a cell phone while driving. Suppose, in a study of drivers who received speeding violations in the last year, and who used cell phone while driving, that 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.

Let y = expected number of drivers who used a cell phone while driving and received speeding violations.

If A and B are independent, then P(A ∩∩ B) = P(A)P(B). By substitution,

y755=(70755)(305755)y755=(70755)(305755)

Solve for yy = (70)(305)755=28.3(70)(305)755=28.3

About 28 people from the sample are expected to use cell phones while driving and to receive speeding violations.

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 hypothesis states that they are not independent (dependent). If we do a test of independence using the example, then the null hypothesis is:

H0H0: Being a cell phone user while driving and receiving a speeding violation are independent events; in other words, they have no effect on each other.

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

The test of independence is always right-tailed because of the calculation of the test statistic. If the expected and observed values are not close together, then the test statistic is very large and way out in the right tail of the chi-square curve, as it is in a goodness-of-fit.

The number of degrees of freedom for the test of independence is:

df = (number of columns – 1)(number of rows – 1)

The following formula calculates the expected number (E):

E=(row total)(column total)total number surveyedE=(row total)(column total)total number surveyed

Try It 11.8

A sample of 300 students is taken. Of the students surveyed, 50 were music students, while 250 were not. Ninety-seven of the 300 surveyed 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?

Example 11.9

A volunteer group, provides from one to nine hours each week with disabled senior citizens. The program recruits among community college students, four-year college students, and nonstudents. In Table 11.15 is a sample of the adult volunteers and the number of hours they volunteer per week.

Type of volunteer1–3 Hours4–6 Hours7–9 HoursRow total
Community college students1119648255
Four-year college students9613361290
Nonstudents9115053294
Column total298379162839
Table 11.15 Number of Hours Worked Per Week by Volunteer Type (Observed) The table contains observed (O) values (data).

Problem

Is the number of hours volunteered independent of the type of volunteer?

Solution

The observed table and the question at the end of the problem, “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.

H0: The number of hours volunteered is independent of the type of volunteer.

Ha: The number of hours volunteered is dependent on the type of volunteer.

The expected results are in Table 11.16.

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
Table 11.16 Number of Hours Worked Per Week by Volunteer Type (Expected) The table contains expected (E) values (data).

For example, the calculation for the expected frequency for the top left cell is

E=(row total)(column total)total number surveyed=(255)(298)839=90.57E=(row total)(column total)total number surveyed=(255)(298)839=90.57

Calculate the test statistic: χ2 = 12.99 (calculator or computer)

Distribution for the test: χ24χ42

df = (3 columns – 1)(3 rows – 1) = (2)(2) = 4

Graph:

Nonsymmetrical chi-square curve with values of 0 and 12.99 on the x-axis representing the test statistic of number of hours worked by volunteers of different types. A vertical upward line extends from 12.99 to the curve and the area to the right of this is equal to the p-value.

Figure 11.8

The graph of the Chi-square shows the distribution and marks the critical value with four degrees of freedom at 95% level of confidence, α = 0.05, 9.488. The graph also marks the calculated χ2cχc2 test statistic of 12.99. Comparing the test statistic with the critical value, as we have done with all other hypothesis tests, we reach the conclusion.

Make a decision: Because the calculated test statistic is in the tail we cannot accept H0. This means that the factors are not independent.

Conclusion: 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.

For the example in Table 11.16, if there had been another type of volunteer, teenagers, what would the degrees of freedom be?

Try It 11.9

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. Table 11.17 shows the results:

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
Table 11.17

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.

Example 11.10

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. Table 11.18 shows the results. De Anza College wants to know if anxiety level and need to succeed in school are independent events.

Need to Succeed in SchoolHigh
Anxiety
Med-high
Anxiety
Medium
Anxiety
Med-low
Anxiety
Low
Anxiety
Row Total
High Need3542531510155
Medium Need1848633331193
Low Need4511151752
Column Total57951276358400
Table 11.18 Need to Succeed in School vs. Anxiety Level

Problem

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

Solution

a. The column total for a high anxiety level is 57. The row total for high need to succeed in school is 155. The sample size or total surveyed is 400.

E=(row total)(column total)total surveyed=155⋅57400=22.09E=(row total)(column total)total surveyed=155⋅57400=22.09

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

Problem

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

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 sample size or total surveyed is 400.

E=(row total)(column total)total surveyed=8.19E=(row total)(column total)total surveyed=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.

Try It 11.10

Refer back to the information in Try It 11.9. How many service providing jobs are there expected to be in 2020? How many nonagriculture wage and salary jobs are there expected to be in 2020?

RELATED POSTS

View all

view all