Published on

Published in: Economy & Finance, Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Chapter 15 The Analysis of Variance
  2. 2. <ul><li>A study was done on the survival time of patients with advanced cancer of the stomach, bronchus, colon, ovary or breast when treated with ascorbate 1 . In this study, the authors wanted to determine if the survival times differ based on the affected organ. </li></ul>A Problem 1 Cameron, E. and Pauling, L. (1978) Supplemental ascorbate in the supportive treatment of cancer: re-evaluation of prolongation of survival time in terminal human cancer. Proceedings of the National Academy of Science , USA, 75 , 4538-4542.
  3. 3. <ul><li>A comparative dotplot of the survival times is shown below. </li></ul>A Problem
  4. 4. <ul><li>H 0 : µ stomach = µ bronchus = µ colon = µ ovary = µ breast </li></ul><ul><li>H a : At least two of the µ ’s are different </li></ul>A Problem The hypotheses used to answer the question of interest are The question is similar to ones encountered in chapter 11 where we looked at tests for the difference of means of two different variables. In this case we are interested in looking a more than two variable.
  5. 5. <ul><li>A single-factor analysis of variance (ANOVA) problems involves a comparison of k population or treatment means µ 1 , µ 2 , … , µ k . </li></ul><ul><li>The objective is to test the hypotheses: </li></ul><ul><li>H 0 : µ 1 = µ 2 = µ 3 = … = µ k </li></ul><ul><li>H a : At least two of the µ ’s are different </li></ul>Single-factor Analysis of Variance (ANOVA)
  6. 6. <ul><li>The analysis is based on k independently selected samples, one from each population or for each treatment. </li></ul><ul><ul><li>In the case of populations, a random sample from each population is selected independently of that from any other population. </li></ul></ul><ul><ul><li>When comparing treatments, the experimental units (subjects or objects) that receive any particular treatment are chosen at random from those available for the experiment. </li></ul></ul>Single-factor Analysis of Variance (ANOVA)
  7. 7. <ul><li>A comparison of treatments based on independently selected experimental units is often referred to as a completely randomized design . </li></ul>Single-factor Analysis of Variance (ANOVA)
  8. 8. Single-factor Analysis of Variance (ANOVA) Notice that in the above comparative dotplot, the differences in the treatment means is large relative to the variability within the samples.
  9. 9. Single-factor Analysis of Variance (ANOVA) Notice that in the above comparative dotplot, the differences in the treatment means is not easily understood relative to the sample variability. ANOVA techniques will allow us to determined if those differences are significant.
  10. 10. ANOVA Notation k = number of populations or treatments being compared Population or treatment 1 2 … k Population or treatment mean µ 1 µ 2 … µ k Sample size n 1 n 2 … n k Sample mean … Population or treatment variance … Sample variance …
  11. 11. ANOVA Notation N = n 1 + n 2 + … + n k (Total number of observations in the data set) T = grand total = sum of all N observations
  12. 12. Assumptions for ANOVA <ul><li>Each of the k populations or treatments, the response distribution is normal. </li></ul><ul><li> 1 =  2 = … =  k (The k normal distributions have identical standard deviations. </li></ul><ul><li>The observations in the sample from any particular one of the k populations or treatments are independent of one another. </li></ul><ul><li>When comparing population means, k random samples are selected independently of one another. When comparing treatment means, treatments are assigned at random to subjects or objects. </li></ul>
  13. 13. Definitions A measure of disparity among the sample means is the treatment sum of squares , denoted by SSTr is given by A measure of variation within the k samples, called error sum of squares and denoted by SSE is given by
  14. 14. Definitions A mean square is a sum of squares divided by its df. In particular, The error df comes from adding the df’s associated with each of the sample variances: (n 1 - 1) + (n 2 - 1) + …+ (n k - 1) = n 1 + n 2 … + n k - 1 - 1 - … - 1 = N - k mean square for treatments = MSTr = mean square for error = MSE =
  15. 15. Example Three filling machines are used by a bottler to fill 12 oz cans of soda. In an attempt to determine if the three machines are filling the cans to the same (mean) level, independent samples of cans filled by each were selected and the amounts of soda in the cans measured. The samples are given below. Machine 1 12.033 11.985 12.009 12.009 12.033 12.025 12.054 12.050 Machine 2 12.031 11.985 11.998 11.992 11.985 12.027 11.987 Machine 3 12.034 12.021 12.038 12.058 12.001 12.020 12.029 12.011 12.021
  16. 16. Example
  17. 17. Example
  18. 18. Example mean square for treatments = MSTr = mean square for error = MSE =
  19. 19. Comments <ul><li>Both MSTr and MSE are quantities that are calculated from sample data. </li></ul><ul><li>As such, both MSTr and MSE are statistics and have sampling distributions. </li></ul>More specifically, when H 0 is true, µ MSTr = µ MSE . However, when H 0 is false, µ MSTr = µ MSE and the greater the differences among the  ’s, the larger µ MSTr will be relative to µ MSE .
  20. 20. The Single-Factor ANOVA F Test Null hypothesis: H 0 : µ 1 = µ 2 = µ 3 = … = µ k Alternate hypothesis: At least two of the µ ’s are different Test Statistic:
  21. 21. The Single-Factor ANOVA F Test When H 0 is true and the ANOVA assumptions are reasonable, F has an F distribution with df 1 = k - 1 and df 2 = N - k. Values of F more contradictory to H 0 than what was calculated are values even farther out in the upper tail, so the P-value is the area captured in the upper tail of the corresponding F curve.
  22. 22. Example Consider the earlier example involving the three filling machines. Machine 1 12.033 11.985 12.009 12.009 12.033 12.025 12.054 12.050 Machine 2 12.031 11.985 11.998 11.992 11.985 12.027 11.987 Machine 3 12.034 12.021 12.038 12.058 12.001 12.020 12.029 12.011 12.021
  23. 23. Example
  24. 24. Example <ul><li>Let µ 1 , µ 2 and µ 3 denote the true mean amount of soda in the cans filled by machines 1, 2 and 3, respectively. </li></ul><ul><li>H 0 : µ 1 = µ 2 = µ 3 </li></ul><ul><li>H a : At least two among are µ 1 , µ 2 and µ 3 </li></ul><ul><ul><li>different </li></ul></ul><ul><li>Significance level:  = 0.01 </li></ul><ul><li>Test statistic: </li></ul>
  25. 25. Example <ul><li>Looking at the comparative dotplot, it seems reasonable to assume that the distributions have the same  ’s. We shall look at the normality assumption on the next slide. * </li></ul>*When the sample sizes are large, we can make judgments about both the equality of the standard deviations and the normality of the underlying populations with a comparative boxplot.
  26. 26. Example <ul><li>Looking at normal plots for the samples, it certainly appears reasonable to assume that the samples from Machine’s 1 and 2 are samples from normal distributions. Unfortunately, the normal plot for the sample from Machine 2 does not appear to be a sample from a normal population. So as to have a computational example, we shall continue and finish the test, treating the result with a “grain of salt.” </li></ul>
  27. 27. Example <ul><li>Computation: </li></ul>
  28. 28. Example <ul><li>P-value: </li></ul>From the F table with numerator df 1 = 2 and denominator df 2 = 21 we can see that 0.025 < P-value < 0.05 (Minitab reports this value to be 0.038 3.835
  29. 29. Example <ul><li>Conclusion: </li></ul><ul><ul><li>Since P-value >  = 0.01, we fail to reject H 0 . We are unable to show that the mean fills are different and conclude that the differences in the mean fills of the machines show no statistically significant differences. </li></ul></ul>
  30. 30. Total Sum of Squares The relationship between the three sums of squares is SSTo = SSTr + SSE which is often called the fundamental identity for single-factor ANOVA . Informally this relation is expressed as Total variation = Explained variation + Unexplained variation Total sum of squares , denoted by SSTo , is given by with associated df = N - 1.
  31. 31. Single-factor ANOVA Table The following is a fairly standard way of presenting the important calculations from an single-factor ANOVA. The output from most statistical packages will contain an additional column giving the P-value.
  32. 32. Single-factor ANOVA Table The ANOVA table supplied by Minitab One-way ANOVA: Fills versus Machine Analysis of Variance for Fills Source DF SS MS F P Machine 2 0.003016 0.001508 3.84 0.038 Error 21 0.008256 0.000393 Total 23 0.011271
  33. 33. Another Example A food company produces 4 different brands of salsa. In order to determine if the four brands had the same sodium levels, 10 bottles of each Brand were randomly (and independently) obtained and the sodium content in milligrams (mg) per tablespoon serving was measured. The sample data are given on the next slide. Use the data to perform an appropriate hypothesis test at the 0.05 level of significance.
  34. 34. Another Example <ul><li>Brand A </li></ul><ul><ul><li>43.85 44.30 45.69 47.13 43.35 </li></ul></ul><ul><ul><li>45.59 45.92 44.89 43.69 44.59 </li></ul></ul><ul><li>Brand B </li></ul><ul><ul><li>42.50 45.63 44.98 43.74 44.95 </li></ul></ul><ul><ul><li>42.99 44.95 45.93 45.54 44.70 </li></ul></ul><ul><li>Brand C </li></ul><ul><ul><li>45.84 48.74 49.25 47.30 46.41 </li></ul></ul><ul><ul><li>46.35 46.31 46.93 48.30 45.13 </li></ul></ul><ul><li>Brand D </li></ul><ul><ul><li>43.81 44.77 43.52 44.63 44.84 </li></ul></ul><ul><ul><li>46.30 46.68 47.55 44.24 45.46 </li></ul></ul>
  35. 35. Another Example <ul><li>Let µ 1 , µ 2 , µ 3 and µ 4 denote the true mean sodium content per tablespoon in each of the brands respectively. </li></ul><ul><li>H 0 : µ 1 = µ 2 = µ 3 = µ 4 </li></ul><ul><li>H a : At least two among are µ 1 , µ 2 , µ 3 and µ 4 are different </li></ul><ul><li>Significance level:  = 0.05 </li></ul><ul><li>Test statistic: </li></ul>
  36. 36. Another Example <ul><li>Looking at the following comparative boxplot, it seems reasonable to assume that the distributions have the equal  ’s as well as the samples being samples from normal distributions. </li></ul>
  37. 37. Example Treatment df = k - 1 = 4 - 1 = 3 <ul><li>Computation: </li></ul><ul><ul><li>Brand k s i </li></ul></ul><ul><ul><li>Brand A 10 44.900 1.180 </li></ul></ul><ul><ul><li>Brand B 10 44.591 1.148 </li></ul></ul><ul><ul><li>Brand C 10 47.056 1.331 </li></ul></ul><ul><ul><li>Brand D 10 45.180 1.304 </li></ul></ul>
  38. 38. Example <ul><li>Computation (continued): </li></ul>Error df = N - k = 40 - 4 = 36
  39. 39. Example <ul><li>P-value: </li></ul><ul><ul><li>F = 7.96 with df numerator = 3 and df denominator = 36 </li></ul></ul>Using df = 30 we find P-value < 0.001 7.96
  40. 40. Example <ul><li>Conclusion: </li></ul><ul><ul><li>Since P-value <  = 0.001, we reject H 0 . We can conclude that the mean sodium content is different for at least two of the Brands. </li></ul></ul>We need to learn how to interpret the results and will spend some time on developing techniques to describe the differences among the µ ’s.
  41. 41. Multiple Comparisons <ul><li>A multiple comparison procedure is a method for identifying differences among the µ ’s once the hypothesis of overall equality (H 0 ) has been rejected. </li></ul><ul><li>The technique we will present is based on computing confidence intervals for difference of means for the pairs. </li></ul>Specifically, if k populations or treatments are studied, we would create k(k-1)/2 differences. (i.e., with 3 treatments one would generate confidence intervals for µ 1 - µ 2 , µ 1 - µ 3 and µ 2 - µ 3 .) Notice that it is only necessary to look at a confidence interval for µ 1 - µ 2 to see if µ 1 and µ 2 differ.
  42. 42. The Tukey-Kramer Multiple Comparison Procedure When there are k populations or treatments being compared, k(k-1)/2 confidence intervals must be computed. If we denote the relevant Studentized range critical value by q, the intervals are as follows: For  i -  j : Two means are judged to differ significantly if the corresponding interval does not include zero.
  43. 43. The Tukey-Kramer Multiple Comparison Procedure When all of the sample sizes are the same, we denote n by n = n 1 = n 2 = n 3 = … = n k , and the confidence intervals (for µ i - µ j ) simplify to
  44. 44. Example (continued) Continuing with example dealing with the sodium content for the four Brands of salsa we shall compute the Tukey-Kramer 95% Tukey-Kramer confidence intervals for µ A - µ B , µ A - µ C , µ A - µ D , µ B - µ C , µ B - µ D and µ C - µ D .
  45. 45. Example (continued) Notice that the confidence intervals for µ A – µ B , µ A – µ C and µ C – µ D do not contain 0 so we can infer that the mean sodium content for Brands C is different from Brands A, B and D.
  46. 46. Example (continued) We also illustrate the differences with the following listing of the sample means in increasing order with lines underneath those blocks of means that are indistinguishable. Brand B Brand A Brand D Brand C 44.591 44.900 45.180 47.056 Notice that the confidence interval for µ A – µ C , µ B – µ C , and µ C – µ D do not contain 0 so we can infer that the mean sodium content for Brand C and all others differ.
  47. 47. Minitab Output for Example One-way ANOVA: Sodium versus Brand Analysis of Variance for Sodium Source DF SS MS F P Brand 3 36.91 12.30 7.96 0.000 Error 36 55.63 1.55 Total 39 92.54 Individual 95% CIs For Mean Based on Pooled StDev Level N Mean StDev ------+---------+---------+---------+ Brand A 10 44.900 1.180 (-----*------) Brand B 10 44.591 1.148 (------*-----) Brand C 10 47.056 1.331 (------*------) Brand D 10 45.180 1.304 (------*-----) ------+---------+---------+---------+ Pooled StDev = 1.243 44.4 45.6 46.8 48.0
  48. 48. Minitab Output for Example Tukey's pairwise comparisons Family error rate = 0.0500 Individual error rate = 0.0107 Critical value = 3.81 Intervals for (column level mean) - (row level mean) Brand A Brand B Brand C Brand B -1.189 1.807 Brand C -3.654 -3.963 -0.658 -0.967 Brand D -1.778 -2.087 0.378 1.218 0.909 3.374
  49. 49. Simultaneous Confidence Level The Tukey-Kramer intervals are created in a manner that controls the simultaneous confidence level . For example at the 95% level, if the procedure is used repeatedly on many different data sets, in the long run only about 5% of the time would at least one of the intervals not include that value of what it is estimating. We then talk about the family error rate being 5% which is the maximum probability of one or more of the confidence intervals of the differences of mean not containing the true difference of mean.
  50. 50. Randomized Block Experiment <ul><li>Suppose that experimental units (individuals or objects to which the treatments are applied) are first separated into groups consisting of k units in such a way that the units within each group are as similar as possible. Within any particular group, the treatments are then randomly allocated so that each unit in a group receives a different treatment. The groups are often called blocks and the experimental design is referred to as a randomized block design . </li></ul>
  51. 51. Example <ul><li>When choosing a variety of melon to plant, one thing that a farmer might be interested in is the length of time (in days) for the variety to bear harvestable fruit. Since the growing conditions (soil, temperature, humidity) also affect this, a farmer might experiment with three hybrid melons (denoted hybrid A, hybrid B and hybrid C) by taking each of the four fields that he wants to use for growing melons and subdividing each field into 3 subplots (1, 2 and 3) and then planting each hybrid in one subplot of each field. The blocks are the fields and the treatments are the hybrid that is planted. The question of interest would be “Are the mean times to bring harvestable fruit the same for all three hybrids?” </li></ul>
  52. 52. Assumptions and Hypotheses <ul><li>The single observation made on any particular treatment in a given block is assumed to be selected from a normal distribution. The variance of this distribution is  2 , the same for each block-treatment combinations. However, the mean value may depend separately both on the treatment applied and on the block. The hypotheses of interest are as follows: </li></ul><ul><ul><li>H 0 : The mean value does not depend on which treatment is applied </li></ul></ul><ul><ul><li>H a : The mean value does depend on which treatment is applied </li></ul></ul>
  53. 53. Summary of the Randomized Block F Test Notation: Let k = number of treatments l = number of blocks = average of all observations in block I = average if all observations for treatment i = average of all kl observations in the experiment (the grand mean)
  54. 54. Summary of the Randomized Block F Test Sums of squares and associated df’s are as follows.
  55. 55. Summary of the Randomized Block F Test SSE is obtained by subtraction through the use of the fundamental identity SSTo = SSTr + SSBl + SSE The test is based on df 1 = k - 1 and df 2 = (k - 1)(l - 1) Test statistic: where
  56. 56. The ANOVA Table for a Randomized Block Experiment
  57. 57. Multiple Comparisons As before, in single-factor ANOVA, once H 0 has been rejected, declare that treatments I and j differ significantly if the interval does not include zero, where q is based on a comparison of k treatments and error df = (k - 1)(l - 1).
  58. 58. Example (Food Prices) <ul><li>In an attempt to measure which of 3 grocery chains has the best overall prices, it was felt that there would be a great deal of variability of prices if items were randomly selected from each of the chains, so a randomized block experiment was devised to answer the question. </li></ul><ul><li>A list of standard items was developed (typically a fairly large representative list would be used, but do to a problem with insufficient planning, only 7 items were left “in the shopping cart.” and the price recorded for each of these items in each of the stores. </li></ul>
  59. 59. Example (Food Prices) <ul><li>Because of the problem that the Blocking variable (the item) wasn’t set up with a well designed, representative sample of the items in a typical shopping basket, the results should be taken with a “grain of salt.” </li></ul><ul><li>For the purposes of showing the calculations, we shall treat this as being the contents of a “representative” shopping basket. </li></ul><ul><li>The data appear in the next slide along with the hypotheses. </li></ul>
  60. 60. Example (Food Prices) H 0 : µ A = µ B = µ C H a : At least two among are µ A , µ B and µ C are different
  61. 61. Calculations
  62. 62. Calculations
  63. 63. Calculations
  64. 64. Conclusions <ul><li>We can reject the hypothesis that the mean prices are the same in all three stores. </li></ul><ul><li>The actual differences can be estimated with confidence intervals. </li></ul>
  65. 65. Conclusions <ul><li>We find q = 4.34 for the 95% Tukey confidence intervals. The confidence intervals are </li></ul>We therefore conclude that Store A is cheaper on the average than Store B and Store C. Store C Store B Store A $2.24 $2.81 $3.20
  66. 66. Two-Factor ANOVA Notation: k = number of levels of factor A l = number of levels of factor B kl = number of treatments (each one a combination of a factor A level and a factor B level) m = number of observations on each treatment
  67. 67. Two-Factor ANOVA Example A grocery store has two stocking supervisors, Fred & Wilma. The store is open 24 hours a day and would like to schedule these two individuals in a manner that is most effective. To help determine how to schedule them, a sample of their work was obtained by scheduling each of them for 5 times in each of the three shifts and then tracked the number of cases of groceries that were emptied and stacked during the shift. The data follows on the next slide.
  68. 68. Two-Factor ANOVA Example
  69. 69. Interactions There is said to be an interaction between the factors , if the change in true average response when the level of one factor changes depend on the level of the other factor. One can look at the possible interaction between two factors by drawing an interactions plot , which is a graph of the means of the response for one factor plotted against the values of the other factor.
  70. 70. Two-Factor ANOVA Example A table of the sample means for the 30 observations.
  71. 71. Two-Factor ANOVA Example Typically, only one of these interactions plots will be constructed. As you can see from these diagrams, there is a suggestion that Fred does better during the day and Wilma is better at night or during the swing shift. The question to ask is “Are these differences significant?” Specifically is there an interaction between the supervisor and the shift.
  72. 72. Interactions <ul><li>If the graphs of true average responses are connected line segments that are parallel, there is no interaction between the factors. In this case, the change in true average response when the level of one factor is changed is the same for each level of the other factor. </li></ul><ul><li>Special cases of no interaction are as follows: </li></ul><ul><ul><li>The true average response is the same for each level of factor A (no factor A main effects). </li></ul></ul><ul><ul><li>The true average response is the same for each level of factor B (no factor B main effects). </li></ul></ul>
  73. 73. Basic Assumptions for Two-Factor ANOVA The observations on any particular treatment are independently selected from a normal distribution with variance  2 (the same variance for each treatment), and samples from different treatments are independent of one another.
  74. 74. Two-Factor ANOVA Table The following is a fairly standard way of presenting the important calculations for an two-factor ANOVA. The fundamental identity is SSTo = SSA + SSB + SSAB +SSE
  75. 75. Two-Factor ANOVA Example
  76. 76. Two-Factor ANOVA Example Minitab output for the Two-Factor ANOVA Two-way ANOVA: Cases versus Shift, Supervisor Analysis of Variance for Cases Source DF SS MS F P Shift 2 5437 2719 1.82 0.184 Supervis 1 7584 7584 5.07 0.034 Interaction 2 14365 7183 4.80 0.018 Error 24 35878 1495 Total 29 63265 1. Test of H 0 : no interaction between supervisor and Shift There is evidence of an interaction.