In this Concept, you will learn how to understand the difference between the chi-square distribution and Student’s t-distribution. You will also learn how to evaluate a hypothesis using the goodness-of-fit test.
For a discussion on
To analyze patterns between distinct categories, such as genders, political candidates, locations, or preferences, we use the chi-square goodness-of-fit test.
This test is used when estimating how closely a sample matches the expected distribution (also known as the goodness-of-fit test) and when estimating if two random variables are independent of one another (also known as the test of independence).
In this lesson, we will learn more about the goodness-of-fit test and how to create and evaluate hypotheses using this test.
The Chi-Square Distribution
The chi-square distribution can be used to perform the goodness-of-fit test , which compares the observed values of a categorical variable with the expected values of that same variable.
We would use the chi-square goodness-of-fit test to evaluate if there was a preference in the type of lunch that
Research Question: Do
Using a sample of 100
|Type of Lunch||Observed Frequency||Expected Frequency|
|Brought Own Lunch||36||25|
If there is no difference in which type of lunch is preferred, we would expect the students to prefer each type of lunch equally. To calculate the expected frequency of each category when assuming school lunch preferences are distributed equally, we divide the number of observations by the number of categories. Since there are 100 observations and 4 categories, the expected frequency of each category is
The Chi-Square Statistic
The value that indicates the comparison between the observed and expected frequency is called the chi-square statistic . The idea is that if the observed frequency is close to the expected frequency, then the chi-square statistic will be small. On the other hand, if there is a substantial difference between the two frequencies, then we would expect the chi-square statistic to be large.
To calculate the chi-square statistic,
We compare the value of the test statistic to a tabled chi-square value to determine the probability that a sample fits an expected pattern.
Features of the Goodness-of-Fit Test
As mentioned, the goodness-of-fit test is used to determine patterns of distinct categorical variables. The test requires that the data are obtained through a random sample. The number of
degrees of freedom
associated with a particular chi-square test is equal to the number of categories minus one. That is,
Using our example about the preferences for types of school lunches, we calculate the degrees of freedom as follows:
There are many situations that use the goodness-of-fit test, including surveys, taste tests, and analysis of behaviors. Interestingly, goodness-of-fit tests are also used in casinos to determine if there is cheating in games of chance, such as cards or dice. For example, if a certain card or number on a die shows up more than expected (a high observed frequency compared to the expected frequency), officials use the goodness-of-fit test to determine the likelihood that the player may be cheating or that the game may not be fair.
Evaluating Hypotheses Using the Goodness-of-Fit Test
Let’s use our original example to create and test a hypothesis using the goodness-of-fit chi-square test. First, we will need to state the null and alternative hypotheses for our research question. Since our research question asks, “Do
Also, the number of degrees of freedom for this test is 3.
Using an alpha level of 0.05, we look under the column for 0.05 and the row for degrees of freedom, which, again, is 3. According to the standard chi-square distribution table, we see that the critical value for chi-square is 7.815. Therefore, we would reject the null hypothesis if the chi-square statistic is greater than 7.815.
Note that we can calculate the chi-square statistic with relative ease.
|Type of Lunch||Observed Frequency||Expected Frequency||
|Brought Own Lunch||36||25||4.84|
Since our chi-square statistic of 10.96 is greater than 7.815, we reject the null hypotheses and accept the alternative hypothesis. Therefore, we can conclude that there is a significant difference between the types of lunches that
On the Web
http://tinyurl.com/3ypvj2h Follow this link to a table of chi-square values.
A game involves rolling 3 dice. The winnings are directly proportional to the number of fives rolled. Suppose someone plays the game 100 times with the following observed counts:
|Number of Fives||Observed Number of rolls|
Someone becomes suspicious and wants to determine whether the dice are fair.
If the dice are fair the probability of rolling a 5 is 1/6. If we roll 3 dice, independently then the number fives in three rolls is distributed as a Binomial (3,1/6).
a. Determine the probability of 0, 1, 2 and 3 fives under this distribution.
b. Determine if the dice are fair (Use a chi-square goodness of fit test).
a. Since we have a binomial distribution with 3 independent trials and probability of success 1/6 on each trial, we can compute the probabilities using either the TI Calculator binompdf(3,1/6, k) where k represents the particular value in which we are interested or we can use the formula
b. First you must find the expected number of rolls for each category. To do this, multiply the probability of each category by 100. For example, the expected number of rolls where you observe zero 5's is
|Number of Fives||Observed Number of rolls||Expected Number of rolls||
You then sum the values in List 3. This will be the value of your chi-square statistic:
In the previous example, we saw that the critical value for a chi-squared statistic at the 0.05 level of significance is 7.815. Since
We use the chi-square test to examine patterns between categorical variables, such as genders, political candidates, locations, or preferences.
There are two types of chi-square tests: the goodness-of-fit test and the test for independence . We use the goodness-of-fit test to estimate how closely a sample matches the expected distribution.
To test for significance , it helps to make a table detailing the observed and expected frequencies of the data sample. Using the standard chi-square distribution table, we are able to create criteria for accepting the null or alternative hypotheses for our research questions.
To test the null hypothesis, it is necessary to calculate the
Using the chi-square statistic and the level of significance , we are able to determine whether to reject or fail to reject the null hypothesis and write a summary statement based on these results.
The marital status distribution of the U.S. Female population, age 18 and older, is as shown below.
(Source: US Census Bureau, “America’s Families and Living Arrangements, 2008)
Suppose a random sample of 400 US young adult females, 18-24 years old, yielded the following frequency distribution. Does this age group of females fit the distribution of the US adult population?
In this problem you determine the expect number for each category by multiplying the proportion by 400, the total number of people in the study.
The chi-square statistic is 238.63 + 30.77 + 33.43 + 16.51 = 319.34 with 3 degrees of freedom. The p-value is 0.00. The decision, at the 0.05 and 0.01 levels of significance, is to reject the null hypothesis. With a goodness-of-fit test, the null hypothesis is always that the two data sets have the same distribution. Since we are rejecting the null hypothesis, this means that this age group of young adult females does not fit the distribution of the US adult population.
What is the name of the statistical test used to analyze the patterns between two categorical variables?
- the ANOVA test
- the chi-square test
There are two types of chi-square tests. Which type of chi-square test estimates how closely a sample matches an expected distribution?
- the goodness-of-fit test
- the test for independence
Which of the following is considered a categorical variable?
If there were 250 observations in a data set and 2 uniformly distributed categories that were being measured, the expected frequency for each category would be:
- What is the formula for calculating the chi-square statistic?
- A principal is planning a field trip. She samples a group of 100 students to see if they prefer a sporting event, a play at the local college, or a science museum. She records the following results:
|Type of Field Trip||Number Preferring|
(a) What is the observed frequency value for the Science Museum category?
(b) What is the expected frequency value for the Sporting Event category?
(c) What would be the null hypothesis for the situation above?
(i) There is no preference between the types of field trips that students prefer.
(ii) There is a preference between the types of field trips that students prefer.
(d) What would be the chi-square statistic for the research question above?
(e) If the estimated chi-square level of significance was 5.99, would you reject or fail to reject the null hypothesis?
On the Web
http://onlinestatbook.com/stat_sim/chisq_theor/index.html Explore what happens when you are using the chi-square statistic when the underlying population from which you are sampling does not follow a normal distribution.
- In 1982 in Western Australia, 1317 males and 854 females died of heart disease, 1119 males and 828 females died of cancer, 371 males and 460 females died of cerebral vascular disease and 346 males and 147 females died of accidents. (source: www.statsci.org/data/z/deathwa.html) Put this information into a contingency table.
For each of the following situations, give the p-value for the given chi-square statistic.
\Chi2=6.7for a table with 3 rows and 3 columns
\Chi2=26.23for a table with 2 rows and 3 columns
Determine the critical value in each of the following situations.
- Level of significance is 05, degrees of freedom = 1
- Level of significance is 0.01; table has 3 rows and 4 columns
- Level of significance is 0.05, degrees of freedom = 8
For each of the following situations determine if the result is statistically significant at the 0.5 level.
- Are the situations in problem 10 statistically significant at the .01 level?
In the following situations, give the expected count for each of the k categories:
Explain whether each of these is possible in a chi-square goodness of fit test.
- The chi-square statistic is negative.
- The chi-square statistic is 0.
- A 6-sided die is rolled 120 times. Conduct a hypothesis test to determine if the die is fair. The data below are the result of the 120 rolls.
- True or False: (if false rewrite so it is true). As the degrees of freedom increase, the graph of the chi-square distribution looks more and more symmetrical.
- True or False: (if false rewrite so it is true). In a goodness of fit test the expected values are the values we would expect if the null hypothesis were true.
- True or False: (if false rewrite so it is true). Use a goodness of fit test to determine if high school principals believe that students are absent equally during the week or not.
- True or False: (if false rewrite so it is true). For a chi-square distribution with 17 degrees of freedom, the probability that a value is greater than 20 is 0.7248.
- True or False: (if false rewrite so it is true). In a goodness of fit test, if the p-value is 0.0113,
Suppose an investigator conducts a study of the relationship between gender (male or female) and book preference (fiction or nonfiction) of children 12 years old.
- Suppose the p-value of the study is not small enough to reject the null hypothesis. Write this conclusion in the context of the situation.
- Now suppose the p-value of the study is small enough to reject the null hypothesis. In the context of the situation, express the conclusion in two different ways.
- Suppose a car dealer offers cars in three different colors: silver, black and white. In a sample of 111 buyers, 59 chose black, 25 chose silver and the remainder chose white. Is there sufficient evidence to conclude that the colors are not equally preferred? Carry out a significance test and be sure to state the null hypothesis and the population to which your conclusion applies.
- The manufacturer of M&Ms states, on the website, the color distribution of M&Ms. Access the website to discover the claim of the manufacturer. Purchase and combine a number of 1-lb bags of M&Ms. Are the observed results statistically significant from the claim of the manufacturer.
Degrees of freedom