Wk4 DQ - Data Analysis & Business Intelligence
Analysis of Variance
Chapter 12
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-1
In this chapter, we continue our discussion of hypothesis testing. We describe a test for variances and then a test that simultaneously compares several population means to determine if they are equal. The simultaneous comparison of several population means is called analysis of variance (ANOVA).
1
Learning Objectives
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
LO12-1 Apply the F distribution to test a hypothesis that two population variances are equal
LO12-2 Use ANOVA to test a hypothesis that three or more population means are equal
LO12-3 Use confidence intervals to test and interpret differences between pairs of population means
LO12-4 Use a blocking variable in a two-way ANOVA to test a hypothesis that three or more population means are equal
LO12-5 Perform a two-way ANOVA with interaction and describe the results
12-2
Characteristics of the F Distribution
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
There is a family of F distributions. Each time the degrees of freedom in either the numerator or the denominator change, a new distribution is created
The F distribution is continuous
The F statistic cannot be negative
The F distribution is positively skewed
The F distribution is asymptotic
12-3
To use the F distribution, the populations must follow a normal distribution, and the data must be at least interval scale. The value of F can assume an infinite number of values between 0 and positive infinity. The smallest value F can assume is 0.The long tail of the F distribution is to the right-hand side. As the value of F increases, the distribution approaches the horizontal axis but never touches it. In the graph, one of the F distributions has a df of 29 in the numerator and 28 df in the denominator; another F distribution has 19 df in the numerator and 6 df in the denominator; and then another F distribution has 6 df in the numerator and 6 df in the denominator. Notice how the shape of the distribution changes as the degrees of freedom changes. As the number of degrees of freedom increases for both the numerator and denominator, the distribution approaches the normal distribution.
3
Comparing Two Population Variances
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
The value of F is computed using the following equation
The larger of the two sample variances is placed in the numerator, forcing the ratio to be at least 1.00
We calculate the standard deviation, s, and square the standard deviations to get the variance, s2, for each population
Example
A health services corporation manages two hospitals in Knoxville: St. Mary’s North and St. Mary’s South. The mean waiting time in both Emergency Departments is 42 minutes. The hospital administrator believes St. Mary’s North has more variation than St. Mary’s South.
12-4
We can use the F distribution to test whether two population variances are the same if the sampled populations follow the normal distribution. We select a random sample of n1 from one population and a random sample of n2 from another population. Here is an example that we could test to see if the two population variances are equal.
4
Compare Two Population Variances Example
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Lammers Limos offers limousine service from Government Center in downtown Toledo, Ohio, to Metro Airport in Detroit. The president of the company is considering two routes. One is via U.S. 25 and the other via I-75. He wants to study the time it takes to get to the airport using each route and compare the results. He collected the following sample data. Using the .10 significance level, is there a difference in the variation in the driving times for the two routes?
12-5
To conduct a test of hypothesis for two population variances, we begin by calculating the mean and the sample standard deviation of each population. The mean driving time is 58.29 minutes for the U.S. 25 route and 59.00 minutes for the I-75 route. To compare the variation in the routes, calculate the standard deviations. We find that there is more variation in the U.S. 25 route, perhaps because there are more stop lights along this route; however, the I-75 route is longer. We will conduct a six-step test of hypothesis to determine if there is really a difference in the variation in the two routes.
5
Compare Two Population Variances Example (2 of 3)
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-6
This is a two-tailed test, so we divide the level of significance (.10) by 2 and get .05. Using Appendix B.6, find the critical value using the degrees of freedom in the numerator, 7 − 1 = 6 df, and the degrees of freedom in the denominator 8-1 = 7 df, the critical value is 3.87. Square the sample standard deviations to get the sample variances. We decide to reject the null hypothesis, the test statistic (4.23) exceeds the critical value (3.87). Mr. Lammers will want to consider the differences in variation in his scheduling.
6
Compare Two Population Variances Example (3 of 3)
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-7
Step 5: Compute the ratio of the two sample variances; it’s 4.23, so we reject H0
Step 6: We conclude there is a difference in the variation in the time to travel the two routes.
The decision is to reject the null hypothesis because the test statistic of 4.23 is larger than the critical value of 3.87.
ANOVA: Analysis of Variance
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
A one-way ANOVA is used to compare two or more treatment means
ANOVA was first developed for use in agriculture; the term treatment was used to identify how different plots of land were treated with different fertilizers
A treatment is a source of variation
The assumptions underlying ANOVA are:
The samples are from populations that follow the normal distribution
The populations have equal standard deviations
The populations are independent
12-8
The ANOVA technique allows us to compare population means simultaneously at a selected significance level. It avoids the buildup of Type I error associated with testing many hypothesis. The term treatment is used to identify the different populations being examined.
8
ANOVA Example
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Joyce Kuhlman manages a regional financial center. She wishes to compare the productivity, as measured by the number of customers served, among three employees. Four days are randomly selected and the number of customers served by each employee is recorded. Is there a difference in the mean number of customers served?
12-9
The chart in the middle illustrates how the populations would appear if there were a difference in the treatment means. Note the distributions follow the normal distribution and the variation in each population is the same, but the means are not the same. Suppose there is no difference in the treatment means. This would indicate the population means are the same. This is shown in the chart on the right. Again the populations follow the normal distribution and the variation in each of the populations is the same.
9
The ANOVA Test
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
First, find the overall mean of the 12 observations. It is 58.
Next, find the difference between each particular value and the overall mean. Square these differences and sum up. This result is the total variation, here 1,082.
TOTAL VARIATION The sum of the squared differences between each observation and the overall mean.
Now, break this total variation in two components: variation due to
treatment variation and random variation.
TREATMENT VARIATION The sum of the squared differences between each treatment mean and the grand or overall mean.
RANDOM VARIATION The sum of the squared differences between each observation and its treatment mean.
12-10
The variation due to treatments is also called variation between treatment means. Random variation is also referred to as the error component.
10
The ANOVA Test Continued
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-11
The variation due to treatments is also called variation between treatment means. If the treatment means are similar, this value will be small; the smallest possible value would be zero. Random variation is also referred to as the error component and is also called the variation within the treatments. When computing the F statistic, in the numerator, we divide the variation due to treatments by 2 because to calculate the sample variance, we divide by n-1, we have 3 treatments, so 3 − 1 = 2. The value in the denominator of the F statistic is the variance within the treatments divided by the total number of observations minus the number of treatments, so 12 − 3 = 9. The ratio of those two estimates is an F of 49.6 and we conclude that the treatment means are not the same. In other words, there is a difference in the productivity of the three employees.
11
Finding the Value of F
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
The formula for the sum of the squares total, SS total, is
The formula for the sum of the squares error, SSE, is
The formula for the sum of the squares treatment, SST, is
This information is summarized in the ANOVA table
12-12
The information for finding the value of F is summarized in an ANOVA table. We will use these formulas in the following example.
12
Finding the Value of F Example
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
A group of four airlines hired Brunner Marketing Research Inc. to survey passengers regarding their level of satisfaction with a recent flight. Twenty-five questions offered a range of possible answers: excellent (4), good (3), fair (2), poor (1), so the highest possible score was 100. Brunner randomly selected and surveyed passengers from the four airlines. Is there a difference in the mean satisfaction level among the four airlines?
12-13
We use the six-step hypothesis testing procedure. The critical value is found in Appendix B.6; with the .01 significance level, move horizontally across the top of the page to (k-1 is 4-1=3 where k equals the number of treatments), so 3 degrees of freedom in the numerator and down that column to the row with (n-k is 22-4=18) where n is the total number of observations, so 18 degrees of freedom. The value at this intersection is 5.09. We calculate SS total, SSE, and SST with the given formulas and then perform the calculations for the F statistic; F= 8.99 which is greater than the critical value, so we reject the null hypothesis and conclude the populations are not all equal, there is a difference in the mean satisfaction level among the four airlines. See the textbook for more detail.
13
Pairs of Means
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
If a null hypothesis of equal treatment means is rejected, we can identify the pairs of means that differ with the following confidence interval
If the confidence interval includes zero, there is not a difference between the treatment means
12-14
If the left endpoint of the confidence interval has a negative sign and the right endpoint has a positive sign, the interval includes zero and the two means do not differ. If zero is not in the interval, then the two treatment means are significantly different. This is a step-by-step process that should only be used after an ANOVA test where the null hypothesis is rejected. See the following example.
14
Pairs of Means Analysis Example
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Recall in the previous example of airline satisfaction, we rejected the null hypothesis that the population means were equal; at least one of the airline’s mean level of satisfaction is different from the others. But we do not know which pairs.
Use formula 12-5 to construct a confidence interval with the mean scores of Northern and Branson. Using a 95% level of confidence, we find the endpoints are 10.457 and 26.043.
Zero is not in the interval; so passengers on Northern rated service significantly different from those on Branson Airlines.
12-15
The confidence intervals in the yellow box were computed using the one-way ANOVA in Minitab. Notice the results for Northern and Branson are identical to the results we obtained using formula 12-5. Further we find that the Branson treatment is different from the WTA and the Northern means; the Pocono treatment mean is different from the Northern mean; and the WTA treatment mean is different from the Northern mean, since all of these intervals do not include zero.
15
A Two-Way ANOVA
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
In a two-way ANOVA, we consider a second treatment variable
This reduces the amount of error variance
The blocking variable determined using equation below
12-16
BLOCKING VARIABLE A second treatment variable that when included in the ANOVA analysis will have the effect of reducing the SSE term.
In the previous airline passengers rating example, there may be other causes of variation. These factors could be the season of the year, the particular airport, or the number of passengers on the flight. The benefit of considering other factors is that we can reduce the error variance. If we can explain more of the variation, then there is less “error.”
16
A Two-Way ANOVA (2 of 2)
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-17
The SSE term, or sum of squares error, is found with the following equation
The two-way ANOVA table includes an additional row for the blocking variable
ANOVA Test Example
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
WARTA, the Warren Area Regional Transit Authority, is expanding bus service from the suburb of Starbrick to the business district of Warren. There are four routes being considered, U.S. 6, West End, Hickory St. , and Rte. 59. WARTA conducted tests to determine whether there is a difference in the mean travel times along the four routes; each driver drove each route. See the travel times in minutes for each driver-route combination below.
At the .05 significance level, is there a difference in the mean travel time along the four routes? If we remove the effects of the drivers, is there a difference in the mean travel time?
12-18
We’ll first conduct a test of hypothesis using a one-way ANOVA. Later, we’ll use a blocking variable in a two-way ANOVA to test a hypothesis that three or more population means are equal.
18
ANOVA Test Example Continued
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-19
19
Two-Way Analysis of Variance
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
In the WARTA example, we only considered the variation due to routes and took all other variables to be random
Now, we’ll include the variance due to the drivers by letting the drivers be the blocking variable
12-20
SSB is the sum of the squares due to the blocking variable. Formula 12-6 for finding the SSB uses: k as the number of treatments, b as the number of blocks, xb as the sample mean of block b, xG as the overall or grand mean. This is going to reduce the SSE, the sum of the squares due to error, and the computed values of the F statistics will be larger.
20
Two-Way Analysis of Variance (2 of 2)
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Including the variance of the drivers, here is a table of the drivers’ respective means, with an overall mean of 22.8 minutes.
12-21
Substituting the information into formula (12-6) we determine SSB, the sum of squares due to the drivers.
21
A Second Treatment Variable Continued
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Determine the F statistics for the treatment variable and the blocking variable from the following ANOVA table
12-22
The same format is used in the two-way ANOVA table as in the one-way case, except there is an additional row for the blocking variable. If we just wanted to reduce the error variation, we should not conduct a hypothesis test for the blocking variable. But if we wish to give the blocks the same status as the treatments, then we may wish to do so; this would be called a two-factor experiment. The values in this table will be used in the next hypothesis test.
22
Hypothesis Test of Equal Treatment Means
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-23
In our example, we are concerned about the difference in the travel time for different drivers, so we’ll conduct a hypothesis test of equal block means. First we test whether the treatment means are equal. Using the F statistic, there are k – 1 degrees of freedom in the numerator (4 − 1 = 3 df) and there are (b − 1)(k − 1) = (5 − 1)(4 − 1) = 12 degrees of freedom in the denominator. Go to Appendix B.6 and the .05 level of significance; the critical value for the first set of hypothesis is 3.49. To calculate the F statistic, divide the MST, the mean square for treatments, by the MSE, the mean square error (we obtain the value for MST and MSE in the table on the preceding slide). We use the first letter of each driver’s name as the subscripts in the second set of hypotheses.
23
Hypothesis Test of Equal Block Means
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-24
The critical value, 3.26, is found in Appendix B.6 using .05 as the level of significance with the degrees of freedom in the numerator as 4 (b − 1 = 5 − 1 = 4), and the degrees of freedom in the denominator as 12 found by (b − 1)(k − 1) = (5 − 1)(4 − 1) =12. To calculate the F statistic, we divide the MSB, the mean square for blocks, by the MSE, the mean square error (we obtain the values for the MSB and MSE in the table on an earlier slide of this example).
24
Hypothesis Test of Equal Block Means (2 of 2)
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-25
Excel has a two-factor ANOVA procedure. The output for the WARTA example just completed is shown.
Interaction Plot
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
An interaction plot illustrates the interaction of the two factors, route and driver
Travel time is the response variable
INTERACTION The effect of one factor on a response variable differs depending on the value of another factor.
12-26
In a two-way ANOVA with repeated observations, we consider two treatment variables and the possible interaction between the variables. In the WARTA example, there could be another effect that influences the travel time; this is called the interaction effect. Differences in travel time may depend on the combined effect of driver and route. This time, each driver will drive each route 3 times; the mean of the three drives is calculated and summarized in the table. To graph the interaction plot, the routes are labeled along the horizontal axis and travel time along the vertical axis. Each line plots the mean travel time for each driver for all four routes with a different color line for each driver. Because the five lines are clearly not parallel, there is an interaction effect of driver and route on travel time. Travel time does depend on the combined effect of driver and route.
26
Interaction Plot (2 of 2)
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-27
To test for interaction, the sample data must be replicated for each route. In this case, each driver drives each route three times, so there are three observed times for each route/driver combination. This information is summarized in the following Excel spreadsheet.
Hypothesis Tests for Interaction
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
The next step is to investigate the interaction effects
Is there an interaction between drivers and routes?
Are the mean travel times for drivers the same?
Are the mean travel times for the routes the same?
Test three sets of hypotheses
Interaction
H0: There is no interaction between drivers and routes
H1: There is interaction between drivers and routes
Blocks
H0: The driver means are equal
H1: At least one driver travel time mean is different
Treatments
H0: The route means are equal
H1: At least one route travel time mean is different
12-28
We test each of these hypotheses as we did in the previous section using the F distribution. The tests are summarized in the following ANOVA table.
28
ANOVA Table including Interactions
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
The complete ANOVA table including interactions
12-29
In a two-way ANOVA with repeated observations, we consider the two treatment variables with the addition of the Interaction source of variation. With a level of significance of .05, we’ll reject the null hypothesis if the computed p-value is less than .05. In Excel, you can use the ANOVA: Two-Factor with Replication in the Data Analysis add-in. In the Excel results, the p-value for the interaction effect is .0456, which is less than .05, so we reject the null hypothesis of no interaction and conclude that the combination of route and driver has a significant effect on the response variable, travel time. Note: the p-value is defined as the probability of computing a value of the test statistic at least as extreme as the one found in the sample data when the null hypothesis is true.
29
A One-Way ANOVA to Test a Hypothesis
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
We will continue the analysis by conducting a one-way ANOVA for each route by testing the hypothesis
H0: Driver times are equal
The results show there are significant differences in the mean travel times among the drivers for every route, except Route 59 which has a p-value of .06.
12-30
A significant interaction effect provides important information about the combined effects of the variables. If interaction is present, then a test of differences in the factor means using a one-way ANOVA for each level of the other factor is the next step. If the p-value is less than .05, we reject the null hypothesis. Here, we find there are significant differences in the mean travel times among the drivers for every route except Rte. 59.
30
Chapter 12 Practice Problems
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-31
Question 5
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-32
Arbitron Media Research Inc. conducted a study of the iPod listening habits of men and women. One facet of the study involved the mean listening time. It was discovered that the mean listening time for a sample of 10 men was 35 minutes per day. The standard deviation was 10 minutes per day. The mean listening time for a sample of 12 women was also 35 minutes, but the standard deviation of the sample was 12 minutes. At the .10 significance level, can we conclude that there is a difference in the variation in the listening times for men and women?
State the null hypothesis and the alternate hypothesis
State the decision rule
Compute the value of the test statistic
What is the p-value
What is your decision regarding H0
Interpret the result
LO12-1
Question 9
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-33
A real estate developer is considering investing in a shopping mall on the outskirts of Atlanta, Georgia. Three parcels of land are being evaluated. Of particular importance is the income in the area surrounding the proposed mall. A random sample of four families is selected near each proposed mall. Following are the sample results. At the .05 significance level, can the developer conclude there is a difference in the mean income?
What are the null and alternate hypotheses?
What is the critical value?
Compute the test statistic.
Compute the p-value.
What is your decision regarding the null hypothesis?
Interpret the result.
LO12-2
Question 11
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-34
The following are three observations collected from treatment 1, five observations collected from treatment 2, and four observations collected from treatment 3. Test the hypothesis that the treatment means are equal at the .05 significance level.
State the null hypothesis and the alternate hypothesis.
What is the decision rule?
Compute SST, SSE, and SS total.
Complete an ANOVA table.
Based on the value of the test statistic, state your decision regarding the null hypothesis.
If H0 is rejected, can we conclude that treatment 1 and treatment 2 differ? Use the 95% level of confidence.
LO12-3
Question 17
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-35
Chapin Manufacturing Company operates 24 hours a day, 5 days a week. The workers rotate shifts each week. Management is interested in whether there is a difference in the number of units produced when the employees work on various shifts. A sample of five workers is selected and their output recorded on each shift. At the .05 significance level, can we conclude there is a difference in the mean production rate by shift or by employee?
LO12-4
Question 19
Copyright ©2021 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
12-36
Consider the following sample data for a two-factor ANOVA analysis. There are two levels (heavy and light) of factor A (weight), and three levels (small, medium, and large) of factor B (size). For each combination of size and weight, there are three observations.
Compute an ANOVA with statistical software, and use the .05 significance level to answer the following questions.
Is there a difference in the Size means?
Is there a difference in the Weight means?
Is there a significant interaction between Weight and Size?
LO12-5