The Chi-Square Distribution

Site: Saylor Academy
Course: BUS204: Business Statistics
Book: The Chi-Square Distribution
Printed by: Guest user
Date: Sunday, May 19, 2024, 11:42 PM

Description

Read this chapter, which introduces you to the three major uses of the chi-squared distribution: the goodness-of-fit test, the test of independence, and the test of a single variance. Attempt the practice problems and homework at the end of the chapter.

Introduction

Figure 11.1 The chi-square distribution can be used to find relationships between two things, like grocery prices at differen


Figure 11.1 The chi-square distribution can be used to find relationships between two things, like grocery prices at different stores.

Have you ever wondered if lottery winning numbers were evenly distributed or if some numbers occurred with a greater frequency? How about if the types of movies people preferred were different across different age groups? What about if a coffee machine was dispensing approximately the same amount of coffee each time? You could answer these questions by conducting a hypothesis test.

You will now study a new distribution, one that is used to determine the answers to such questions. This distribution is called the chi-square distribution.

In this chapter, you will learn the three major applications of the chi-square distribution:

  1. the goodness-of-fit test, which determines if data fit a particular distribution, such as in the lottery example
  2. the test of independence, which determines if events are independent, such as in the movie example
  3. the test of a single variance, which tests variability, such as in the coffee example

Source: OpenStax, https://openstax.org/books/introductory-business-statistics/pages/11-introduction
Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 License.

Facts About the Chi-Square Distribution

The notation for the chi-square distribution is:

χ∼χ^2_{df}

where df = degrees of freedom which depends on how chi-square is being used. (If you want to practice calculating chi-square probabilities then use df = n - 1. The degrees of freedom for the three major uses are each calculated differently).

For the χ^2 distribution, the population mean is μ = df and the population standard deviation is σ=\sqrt{2(df)}.

The random variable is shown as χ^2.

The random variable for a chi-square distribution with k degrees of freedom is the sum of k independent, squared standard normal variables.

χ^2 = (Z_1)^2 + (Z_2)^2 + ... + (Z_k)^2

  1. The curve is nonsymmetrical and skewed to the right.
  2. There is a different chi-square curve for each df.


    Figure 11.2
    Figure 11.2

  3. The test statistic for any test is always greater than or equal to zero.
  4. When df > 90, the chi-square curve approximates the normal distribution. For X ~ χ^2_{1,000} the mean, μ = df = 1,000 and the standard deviation, σ = \sqrt{2(1,000)} = 44.7. Therefore, X ~ N(1,000, 44.7), approximately.
  5. The mean, μ, is located just to the right of the peak.

Test of a Single Variance

Thus far our interest has been exclusively on the population parameter μ or it's counterpart in the binomial, p. Surely the mean of a population is the most critical piece of information to have, but in some cases we are interested in the variability of the outcomes of some distribution. In almost all production processes quality is measured not only by how closely the machine matches the target, but also the variability of the process. If one were filling bags with potato chips not only would there be interest in the average weight of the bag, but also how much variation there was in the weights. No one wants to be assured that the average weight is accurate when their bag has no chips. Electricity voltage may meet some average level, but great variability, spikes, can cause serious damage to electrical machines, especially computers. I would not only like to have a high mean grade in my classes, but also low variation about this mean. In short, statistical tests concerning the variance of a distribution have great value and many applications.

A test of a single variance assumes that the underlying distribution is normal. The null and alternative hypotheses are stated in terms of the population variance. The test statistic is:

χ^2_c=\dfrac{(n−1)s^2}{σ^2_0}

where:

  • n = the total number of observations in the sample data
  • s^2 = sample variance
  • σ^2_0 = hypothesized value of the population variance
  • H_0:σ^2=σ^2_0
  • H_a:σ^2≠σ^2_0

You may think of s as the random variable in this test. The number of degrees of freedom is df = n - 1. A test of a single variance may be right-tailed, left-tailed, or two-tailed. Example 11.1 will show you how to set up the null and alternative hypotheses. The null and alternative hypotheses contain statements about the population variance.


Example 11.1

Problem
Math instructors are not only interested in how their students do on exams, on average, but how the exam scores vary. To many instructors, the variance (or standard deviation) may be more important than the average.

Suppose a math instructor believes that the standard deviation for his final exam is five points. One of his best students thinks otherwise. The student claims that the standard deviation is more than five points. If the student were to conduct a hypothesis test, what would the null and alternative hypotheses be?

Solution 1
Even though we are given the population standard deviation, we can set up the test using the population variance as follows.

  • H_0: σ^2 ≤ 5^2
  • H_a: σ^2 > 5^2


Try It 11.1

A SCUBA instructor wants to record the collective depths each of his students' dives during their checkout. He is interested in how the depths vary, even though everyone should have been at the same depth. He believes the standard deviation is three feet. His assistant thinks the standard deviation is less than three feet. If the instructor were to conduct a test, what would the null and alternative hypotheses be?


Example 11.2

Problem
With individual lines at its various windows, a post office finds that the standard deviation for waiting times for customers on Friday afternoon is 7.2 minutes. The post office experiments with a single, main waiting line and finds that for a random sample of 25 customers, the waiting times for customers have a standard deviation of 3.5 minutes on a Friday afternoon.

With a significance level of 5%, test the claim that a single line causes lower variation among waiting times for customers.

Solution 1
Since the claim is that a single line causes less variation, this is a test of a single variance. The parameter is the population variance, σ2.

Random Variable: The sample standard deviation, s, is the random variable. Let s = standard deviation for the waiting times.

  • H_0: σ^2 ≥ 7.2^2
  • H_a: σ^2 < 7.2^2

The word "less" tells you this is a left-tailed test.

Distribution for the test:
χ^2_{24}, where:

  • n = the number of customers sampled
  • df = n – 1 = 25 – 1 = 24

Calculate the test statistic:

χ^2_c=\dfrac{(n − 1)s^2}{σ^2}=\dfrac{(25 − 1)(3.5)^2}{7.2^2}=5.67

where n = 25, s = 3.5, and σ = 7.2.

Figure 11.3

Figure 11.3

The graph of the Chi-square shows the distribution and marks the critical value with 24 degrees of freedom at 95% level of confidence, α = 0.05, 13.85. The critical value of 13.85 came from the Chi squared table which is read very much like the students t table. The difference is that the students t-distribution is symmetrical and the Chi squared distribution is not. At the top of the Chi squared table we see not only the familiar 0.05, 0.10, etc. but also 0.95, 0.975, etc. These are the columns used to find the left hand critical value. The graph also marks the calculated χ2 test statistic of 5.67. 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 you reject σ^2 ≥ 7.2^2. In other words, you do not think the variation in waiting times is 7.2 minutes or more; you think the variation in waiting times is less.

Conclusion: At a 5% level of significance, from the data, there is sufficient evidence to conclude that a single line causes a lower variation among the waiting times or with a single line, the customer waiting times vary less than 7.2 minutes.


Example 11.3

Professor Hadley has a weakness for cream filled donuts, but he believes that some bakeries are not properly filling the donuts. A sample of 24 donuts reveals a mean amount of filling equal to 0.04 cups, and the sample standard deviation is 0.11 cups. Professor Hadley has an interest in the average quantity of filling, of course, but he is particularly distressed if one donut is radically different from another. Professor Hadley does not like surprises.

Problem
Test at 95% the null hypothesis that the population variance of donut filling is significantly different from the average amount of filling.

Solution 1
This is clearly a problem dealing with variances. In this case we are testing a single sample rather than comparing two samples from different populations. The null and alternative hypotheses are thus:

H_0 : σ^2=0.04

H_0 : σ^2 ≠ 0.04

The test is set up as a two-tailed test because Professor Hadley has shown concern with too much variation in filling as well as too little: his dislike of a surprise is any level of filling outside the expected average of 0.04 cups. The test statistic is calculated to be:

χc^2=\dfrac{(n−1)s^2}{σ^2_o}=\dfrac{(24−1)0.11^2}{0.04^2}=6.9575

The calculated χ^2 test statistic, 6.96, is in the tail therefore at a 0.05 level of significance, we cannot accept the null hypothesis that the variance in the donut filling is equal to 0.04 cups. It seems that Professor Hadley is destined to meet disappointment with each bit.

Figure 11.4
Figure 11.4

Try It 11.3

The FCC conducts broadband speed tests to measure how much data per second passes between a consumer's computer and the internet. As of August of 2012, the standard deviation of Internet speeds across Internet Service Providers (ISPs) was 12.2 percent. Suppose a sample of 15 ISPs is taken, and the standard deviation is 13.2. An analyst claims that the standard deviation of speeds is more than what was reported. State the null and alternative hypotheses, compute the degrees of freedom, the test statistic, sketch the graph of the distribution and mark the area associated with the level of confidence, and draw a conclusion. Test at the 1% significance level.

Goodness-of-Fit Test

In this type of hypothesis test, you determine whether the data "fit" a particular distribution or not. For example, you may suspect your unknown data fit a binomial distribution. You use a chi-square test (meaning the distribution for the hypothesis test is chi-square) to determine if there is a fit or not. The null and the alternative hypotheses for this test may be written in sentences or may be stated as equations or inequalities.

The test statistic for a goodness-of-fit test is:

Σ_k\dfrac{(O−E)^2}{E}

where:

  • O = observed values (data)
  • E = expected values (from theory)
  • k = the number of different data cells or categories

The observed values are the data values and the expected values are the values you would expect to get if the null hypothesis were true. There are n terms of the form \dfrac{(O−E)^2}{E}.

The number of degrees of freedom is df = (number of categories – 1).

The goodness-of-fit test is almost always right-tailed. If the observed values and the corresponding expected values are not close to each other, then the test statistic can get very large and will be way out in the right tail of the chi-square curve.

Note

The number of expected values inside each cell needs to be at least five in order to use this test.


Example 11.4

Absenteeism of college students from math classes is a major concern to math instructors because missing class appears to increase the drop rate. Suppose that a study was done to determine if the actual student absenteeism rate follows faculty perception. The faculty expected that a group of 100 students would miss class according to Table 11.1.

Number of absences per term Expected number of students
0–2 50
3–5 30
6–8 12
9–11 6
12+ 2

Table 11.1

A random survey across all mathematics courses was then done to determine the actual number (observed) of absences in a course. The chart in Table 11.2 displays the results of that survey.

Number of absences per term Actual number of students
0–2 35
3–5 40
6–8 20
9–11 1
12+ 4

Table 11.2

Determine the null and alternative hypotheses needed to conduct a goodness-of-fit test.

H0: Student absenteeism fits faculty perception.

The alternative hypothesis is the opposite of the null hypothesis.

Ha: Student absenteeism does not fit faculty perception.

Problem
a. Can you use the information as it appears in the charts to conduct the goodness-of-fit test?

Solution 1
a. No. Notice that the expected number of absences for the "12+" entry is less than five (it is two). Combine that group with the "9–11" group to create new tables where the number of students for each entry are at least five. The new results are in Table 11.3 and Table 11.4.

Number of absences per term Expected number of students
0–2 50
3–5 30
6–8 12
9+ 8

Table 11.3

Number of absences per term Actual number of students
0–2 35
3–5 40
6–8 20
9+ 5

Table 11.4

Problem
b. What is the number of degrees of freedom (df)?

Solution 2
b. There are four "cells" or categories in each of the new tables.

df = number of cells – 1 = 4 – 1 = 3


Try It 11.4
A factory manager needs to understand how many products are defective versus how many are produced. The number of expected defects is listed in Table 11.5.

Number produced Number defective
0–100 5
101–200 6
201–300 7
301–400 8
401–500 10

Table 11.5

A random sample was taken to determine the actual number of defects. Table 11.6 shows the results of the survey.

Number produced Number defective
0–100 5
101–200 7
201–300 8
301–400 9
401–500 11

Table 11.6

State the null and alternative hypotheses needed to conduct a goodness-of-fit test, and state the degrees of freedom.


Example 11.5
Problem
Employers want to know which days of the week employees are absent in a five-day work week. Most employers would like to believe that employees are absent equally during the week. Suppose a random sample of 60 managers were asked on which day of the week they had the highest number of employee absences. The results were distributed as in Table 11.7. For the population of employees, do the days for the highest number of absences occur with equal frequencies during a five-day work week? Test at a 5% significance level.

Monday Tuesday Wednesday Thursday Friday
Number of absences 15 12 9 9 15

Table 11.7 Day of the Week Employees were Most Absent

Solution 1
The null and alternative hypotheses are:

  • H0: The absent days occur with equal frequencies, that is, they fit a uniform distribution.
  • Ha: The absent days occur with unequal frequencies, that is, they do not fit a uniform distribution.
If the absent days occur with equal frequencies, then, out of 60 absent days (the total in the sample: 15 + 12 + 9 + 9 + 15 = 60), there would be 12 absences on Monday, 12 on Tuesday, 12 on Wednesday, 12 on Thursday, and 12 on Friday. These numbers are the expected (E) values. The values in the table are the observed (O) values or data.

This time, calculate the χ2 test statistic by hand. Make a chart with the following headings and fill in the columns:

  • Expected (E) values (12, 12, 12, 12, 12)
  • Observed (O) values (15, 12, 9, 9, 15)
  • (O – E)
  • (O – E)2
  • \dfrac{(O – E)^2}{E}
Now add (sum) the last column. The sum is three. This is the χ2 test statistic.

The calculated test statistics is 3 and the critical value of the χ2 distribution at 4 degrees of freedom the 0.05 level of confidence is 9.48. This value is found in the χ2 table at the 0.05 column on the degrees of freedom row 4.

The degrees of freedom are the number of cells – 1 = 5 – 1 = 4

Next, complete a graph like the following one with the proper labeling and shading. (You should shade the right tail).

Figure 11.5
Figure 11.5


χ^2_c=Σ_k\dfrac{(O−E)^2}{E}=3

The decision is not to reject the null hypothesis because the calculated value of the test statistic is not in the tail of the distribution.

Conclusion: At a 5% level of significance, from the sample data, there is not sufficient evidence to conclude that the absent days do not occur with equal frequencies.


Try It 11.5
Teachers want to know which night each week their students are doing most of their homework. Most teachers think that students do homework equally throughout the week. Suppose a random sample of 56 students were asked on which night of the week they did the most homework. The results were distributed as in Table 11.8.

Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Number of students 11 8 10 7 10 5 5

Table 11.8

From the population of students, do the nights for the highest number of students doing the majority of their homework occur with equal frequencies during a week? What type of hypothesis test should you use?


Example 11.6
One study indicates that the number of televisions that American families have is distributed (this is the given distribution for the American population) as in Table 11.9.

Number of Televisions Percent
0 10
1 16
2 55
3 11
4+ 8

Table 11.9

The table contains expected (E) percents.

A random sample of 600 families in the far western United States resulted in the data in Table 11.10.

Number of Televisions Frequency
0 66
1 119
2 340
3 60
4+ 15
Total = 600

Table 11.10

The table contains observed (O) frequency values.

Problem
At the 1% significance level, does it appear that the distribution "number of televisions" of far western United States families is different from the distribution for the American population as a whole?

Solution 1
This problem asks you to test whether the far western United States families distribution fits the distribution of the American families. This test is always right-tailed.

The first table contains expected percentages. To get expected (E) frequencies, multiply the percentage by 600. The expected frequencies are shown in Table 11.11.

Number of televisions Percent Expected frequency
0 10 (0.10)(600) = 60
1 16 (0.16)(600) = 96
2 55 (0.55)(600) = 330
3 11 (0.11)(600) = 66
over 3 8 (0.08)(600) = 48

Table 11.11

Therefore, the expected frequencies are 60, 96, 330, 66, and 48.

H0: The "number of televisions" distribution of far western United States families is the same as the "number of televisions" distribution of the American population.

Ha: The "number of televisions" distribution of far western United States families is different from the "number of televisions" distribution of the American population.

Distribution for the test: χ^2_4 where df = (the number of cells) – 1 = 5 – 1 = 4.

Calculate the test statistic: χ2 = 29.65

Graph:
Figure 11.6

Figure 11.6

The graph of the Chi-square shows the distribution and marks the critical value with four degrees of freedom at 99% level of confidence, α = .01, 13.277. The graph also marks the calculated chi squared test statistic of 29.65. 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 test statistic is in the tail of the distribution we cannot accept the null hypothesis.

This means you reject the belief that the distribution for the far western states is the same as that of the American population as a whole.

Conclusion: At the 1% significance level, from the data, there is sufficient evidence to conclude that the "number of televisions" distribution for the far western United States is different from the "number of televisions" distribution for the American population as a whole.


Try It 11.6
The expected percentage of the number of pets students have in their homes is distributed (this is the given distribution for the student population of the United States) as in Table 11.12.

Number of pets Percent
0 18
1 25
2 30
3 18
4+ 9

Table 11.12

A random sample of 1,000 students from the Eastern United States resulted in the data in Table 11.13.

Number of pets Frequency
0 210
1 240
2 320
3 140
4+ 90

Table 11.13

At the 1% significance level, does it appear that the distribution "number of pets" of students in the Eastern United States is different from the distribution for the United States student population as a whole?


Example 11.7
Problem
Suppose you flip two coins 100 times. The results are 20 HH, 27 HT, 30 TH, and 23 TT. Are the coins fair? Test at a 5% significance level.

Solution 1
This problem can be set up as a goodness-of-fit problem. The sample space for flipping two fair coins is {HH, HT, TH, TT}. Out of 100 flips, you would expect 25 HH, 25 HT, 25 TH, and 25 TT. This is the expected distribution from the binomial probability distribution. The question, "Are the coins fair?" is the same as saying, "Does the distribution of the coins (20 HH, 27 HT, 30 TH, 23 TT) fit the expected distribution?"

Random Variable: Let X = the number of heads in one flip of the two coins. X takes on the values 0, 1, 2. (There are 0, 1, or 2 heads in the flip of two coins). Therefore, the number of cells is three. Since X = the number of heads, the observed frequencies are 20 (for two heads), 57 (for one head), and 23 (for zero heads or both tails). The expected frequencies are 25 (for two heads), 50 (for one head), and 25 (for zero heads or both tails). This test is right-tailed.

H0: The coins are fair.

Ha: The coins are not fair.

Distribution for the test:
χ^2_2 where df = 3 – 1 = 2.

Calculate the test statistic: χ2 = 2.14

Graph:
Figure 11.7

Figure 11.7

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

Conclusion: There is insufficient evidence to conclude that the coins are not fair: we cannot reject the null hypothesis that the coins are fair.

Test of Independence

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)} \dfrac{(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⋅j terms of the form \dfrac{(O–E)^2}{E}.

A test of independence determines whether two factors are independent or not. You first encountered the term independence in 3.2 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,

\dfrac{y}{755}=(\dfrac{70}{755})(\dfrac{305}{755})

Solve for y: y = \dfrac{(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:

H0: 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=\dfrac{\text{(row total)(column total)}}{\text{total 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.14 is a sample of the adult volunteers and the number of hours they volunteer per week.

Type of volunteer 1–3 Hours 4–6 Hours 7–9 Hours Row total
Community college students 111 96 48 255
Four-year college students 96 133 61 290
Nonstudents 91 150 53 294
Column total 298 379 162 839

Table 11.14 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 1
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.15.

Type of volunteer 1-3 Hours 4-6 Hours 7-9 Hours
Community college students 90.57 115.19 49.24
Four-year college students 103.00 131.00 56.00
Nonstudents 104.42 132.81 56.77

Table 11.15 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=\dfrac{\text{(row total)(column total)}}{\text{total surveyed}} =\dfrac{(255)(298)}{839}=90.57

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

Distribution for the test: χ^2_4

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

Graph:
Figure 11.8
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 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.15, 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.16 shows the results:

Industry sector 2000 2010 2020 Total
Nonagriculture wage and salary 13,243 13,044 15,018 41,305
Goods-producing, excluding agriculture 2,457 1,771 1,950 6,178
Services-providing 10,786 11,273 13,068 35,127
Agriculture, forestry, fishing, and hunting 240 214 201 655
Nonagriculture self-employed and unpaid family worker 931 894 972 2,797
Secondary wage and salary jobs in agriculture and private household industries 14 11 11 36
Secondary jobs as a self-employed or unpaid family worker 196 144 152 492
Total 27,867 27,351 31,372 86,590

Table 11.16

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.17 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 school High
anxiety
Med-high
anxiety
Medium
anxiety
Med-low
anxiety
Low
anxiety
Row total
High need 35 42 53 15 10 155
Medium need 18 48 63 33 31 193
Low need 4 5 11 15 17 52
Column total 57 95 127 63 58 400

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

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=\dfrac{\text{(row total)(column total)}}{\text{total surveyed}} =\dfrac{155⋅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.

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 2
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.

Problem
c. E=\dfrac{\text{(row total)(column total)}}{\text{total surveyed}} = ________

Solution 3
c. E=\dfrac{\text{(row total)(column total)}}{\text{total surveyed}}=8.19

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

Solution 4
d. 8

Test for Homogeneity

The goodness–of–fit test can be used to decide whether a population fits a given distribution, but it will not suffice to decide whether two populations follow the same unknown distribution. A different test, called the test for homogeneity, can be used to draw a conclusion about whether two populations have the same distribution. To calculate the test statistic for a test for homogeneity, follow the same procedure as with the test of independence.


Note

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

Hypotheses

H0: The distributions of the two populations are the same.

Ha: The distributions of the two populations are not the same.

Test Statistic

Use a χ2 test statistic. It is computed in the same way as the test for independence.

Degrees of Freedom (df)

df = number of columns - 1

Requirements

All values in the table must be greater than or equal to five.

Common Uses

Comparing two populations. For example: men vs. women, before vs. after, east vs. west. The variable is categorical with more than two possible response values.


Example 11.11

Problem

Do male and female college students have the same distribution of living arrangements? Use a level of significance of 0.05. Suppose that 250 randomly selected male college students and 300 randomly selected female college students were asked about their living arrangements: dormitory, apartment, with parents, other. The results are shown in Table 11.18. Do male and female college students have the same distribution of living arrangements?

Dormitory Apartment With Parents Other
Males 72 84 49 45
Females 91 86 88 35

Table 11.18 Distribution of living arrangements for college males and college females

Solution 1
H0: The distribution of living arrangements for male college students is the same as the distribution of living arrangements for female college students.

Ha: The distribution of living arrangements for male college students is not the same as the distribution of living arrangements for female college students.

Degrees of Freedom (df):
df = number of columns – 1 = 4 – 1 = 3

Distribution for the test: χ^2_3

Calculate the test statistic: χ^2_c = 10.129

Figure 11.9
Figure 11.9

The graph of the Chi-square shows the distribution and marks the critical value with three degrees of freedom at 95% level of confidence, α = 0.05, 7.815. The graph also marks the calculated χ2 test statistic of 10.129. 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 distributions are not the same.

Conclusion: At a 5% level of significance, from the data, there is sufficient evidence to conclude that the distributions of living arrangements for male and female college students are not the same.

Notice that the conclusion is only that the distributions are not the same. We cannot use the test for homogeneity to draw any conclusions about how they differ.


Try It 11.11
Do families and singles have the same distribution of cars? Use a level of significance of 0.05. Suppose that 100 randomly selected families and 200 randomly selected singles were asked what type of car they drove: sport, sedan, hatchback, truck, van/SUV. The results are shown in Table 11.19. Do families and singles have the same distribution of cars? Test at a level of significance of 0.05.

Sport Sedan Hatchback Truck Van/SUV
Family 5 15 35 17 28
Single 45 65 37 46 7

Table 11.19


Try It 11.11
Ivy League schools receive many applications, but only some can be accepted. At the schools listed in Table 11.20, two types of applications are accepted: regular and early decision.

Application type accepted Brown Columbia Cornell Dartmouth Penn Yale
Regular 2,115 1,792 5,306 1,734 2,685 1,245
Early decision 577 627 1,228 444 1,195 761

Table 11.20

We want to know if the number of regular applications accepted follows the same distribution as the number of early applications accepted. State the null and alternative hypotheses, the degrees of freedom and the test statistic, sketch the graph of the χ2 distribution and show the critical value and the calculated value of the test statistic, and draw a conclusion about the test of homogeneity.

Comparison of the Chi-Square Tests

Above the χ2 test statistic was used in three different circumstances. The following bulleted list is a summary of which χ2 test is the appropriate one to use in different circumstances.

  • Goodness-of-Fit: Use the goodness-of-fit test to decide whether a population with an unknown distribution "fits" a known distribution. In this case there will be a single qualitative survey question or a single outcome of an experiment from a single population. Goodness-of-Fit is typically used to see if the population is uniform (all outcomes occur with equal frequency), the population is normal, or the population is the same as another population with a known distribution. The null and alternative hypotheses are:

    H0: The population fits the given distribution.
    Ha: The population does not fit the given distribution.

  • Independence: Use the test for independence to decide whether two variables (factors) are independent or dependent. In this case there will be two qualitative survey questions or experiments and a contingency table will be constructed. The goal is to see if the two variables are unrelated (independent) or related (dependent). The null and alternative hypotheses are:
    H0: The two variables (factors) are independent.
    Ha: The two variables (factors) are dependent.

  • Homogeneity: Use the test for homogeneity to decide if two populations with unknown distributions have the same distribution as each other. In this case there will be a single qualitative survey question or experiment given to two different populations. The null and alternative hypotheses are:
    H0: The two populations follow the same distribution.
    Ha: The two populations have different distributions.