1 / 45

ANOVA

STAT 101 Dr. Kari Lock Morgan. ANOVA. SECTION 8.1 Testing for a difference in means across multiple categories. Review: Chi-Square Tests. The χ 2 goodness-of-fit tests if one categorical variable differs from a null distribution

pilar
Télécharger la présentation

ANOVA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. STAT 101 Dr. Kari Lock Morgan ANOVA • SECTION 8.1 • Testing for a difference in means across multiple categories

  2. Review: Chi-Square Tests • The χ2 goodness-of-fit tests if one categorical variable differs from a null distribution • The χ2 test for association tests for an association between twocategorical variables • For both, you compute the expected counts in each cell (assuming H0) and the χ2 statistic: • Find the proportion above the χ2 statistic in a randomization or χ2-distribution (if all expected counts > 5)

  3. Multiple Categories • So far, we’ve learned how to do inference for a difference in means IF the categorical variable has only two categories • Today, we’ll learn how to do hypothesis tests for a difference in means across multiple categories

  4. Hypothesis Testing • State Hypotheses • Calculate a statistic, based on your sample data • Create a distribution of this statistic, as it would be observed if the null hypothesis were true • Measure how extreme your test statistic from (2) is, as compared to the distribution generated in (3) test statistic

  5. Cuckoo Birds • Cuckoo birds lay their eggs in the nests of other birds • When the cuckoo baby hatches, it kicks out all the original eggs/babies • If the cuckoo is lucky, the mother will raise the cuckoo as if it were her own • Do cuckoo birds found in nests of different species differ in size? http://opinionator.blogs.nytimes.com/2010/06/01/cuckoo-cuckoo/

  6. Length of Cuckoo Eggs

  7. Notation • k = number of groups • nj = number of units in group j • n = overall number of units • = n1 + n2 + … + nk

  8. Cuckoo Eggs • k = 5 • n1 = 15, n2 = 60, n3 = 16, n4 = 14, n5 = 15 • n = 120

  9. Hypotheses • To test for a difference in means across k groups:

  10. Test Statistic Why can’t use the familiar formula to get the test statistic? • We need something a bit more complicated…

  11. Difference in Means Whether or not two means are significantly different depends on • How far apart the means are • How much variability there is within each group

  12. Difference in Means

  13. Analysis of Variance • Analysis of Variance (ANOVA) compares the variability between groupsto the variability within groups Total Variability Variability Between Groups Variability Within Groups

  14. Analysis of Variance • If the groups are actually different, then • the variability between groups should be higher than the variability within groups • the variability within groups should be higher than the variability between groups

  15. Discoveries for Today • How to measure variability between groups? • How to measure variability within groups? • How to compare the two measures? • How to determine significance?

  16. Discoveries for Today • How to measure variability between groups? • How to measure variability within groups? • How to compare the two measures? • How to determine significance?

  17. Sums of Squares • We will measure variability as sums of squared deviations (aka sums of squares) • familiar?

  18. Sums of Squares Total Variability Variability Between Groups Variability Within Groups data value i overall mean mean in group j overall mean ithdata value in group j mean in group j Sum over all data values Sum over all groups Sum over all data values

  19. Deviations Group 1 Group 1 Mean Group 2 Overall Mean

  20. Sums of Squares Total Variability Variability Between Groups Variability Within Groups SST (Total sum of squares) SSG (sum of squares due to groups) SSE (“Error” sum of squares)

  21. Cuckoo Birds

  22. ANOVA Table The “mean square” is the sum of squares divided by the degrees of freedom average variability variability

  23. ANOVA Table • Fill in the beginnings of the ANOVA table based on the Cuckoo birds data. SSG = 35.9 SSE = 101.20

  24. ANOVA Table • Fill in the beginnings of the ANOVA table based on the Cuckoo birds data.

  25. Discoveries for Today • How to measure variability between groups? • How to measure variability within groups? • How to compare the two measures? • How to determine significance?

  26. F-Statistic • The F-statisticis a ratio of the average variability between groups to the average variability within groups

  27. ANOVA Table

  28. Cuckoo Eggs

  29. F-statistic • If there really is a difference between the groups, we would expect the F-statistic to be • Higher than we would observe by random chance • Lower than we would observe by random chance

  30. Discoveries for Today • How to measure variability between groups? • How to measure variability within groups? • How to compare the two measures? • How to determine significance?

  31. How to determine significance? • We have a test statistic. What else do we need to perform the hypothesis test? • A distribution of the test statistic assuming H0 is true • How do we get this? Two options: • Simulation • Distributional Theory

  32. Simulation • www.lock5stat.com/statkey Because a difference would make the F-statistic higher, calculate proportion in the upper tail An F-statistic this large would be very unlikely to happen just by random chance if the means were all equal, so we have strong evidence that the mean lengths of cuckoo birds in nests of different species are not all equal.

  33. F-distribution F-distribution

  34. F-Distribution • If the following conditions hold, • Sample sizes in each group are large (each nj≥ 30) OR the data are relatively normally distributed • Variability is similar in all groups • The null hypothesis is true • then the F-statistic follows an F-distribution • The F-distribution has two degrees of freedom, one for the numerator of the ratio (k – 1) and one for the denominator (n – k)

  35. Equal Variance • The F-distribution assumes equal within group variability for each group • As a rough rule of thumb, this assumption is violated if the standard deviation of one group is more than double the standard deviation of another group

  36. F-distribution • Can we use the F-distribution to calculate the p-value for the Cuckoo bird eggs? • Yes • No • Need more • information

  37. Length of Cuckoo Eggs

  38. ANOVA Table

  39. Cuckoo Eggs

  40. ANOVA Table • Equal variability • Normal(ish) data We have very strong evidence that average length of cuckoo eggs differs for nests of different species

  41. Study Hours by Class Year • Can we use the F-distribution to calculate the p-value for whether there is a difference in average hours spent studying per week by class year at Duke? • Yes • No • Need more • information

  42. Study Hours by Class Year Is there a difference in the average hours spent studying per week by class year at Duke? Yes No Cannot tell from this data I didn’t finish

  43. ANOVA Table

  44. Summary • Analysis of variance is used to test for a difference in means between groups by comparing the variability between groups to the variability within groups • Sums of squares are used to measure variability • The F-statistic is the ratio of average variability between groups to average variability within groups • The F-statistic follows an F-distribution, if sample sizes are large (or data is normal), variability is equal across groups, and the null hypothesis is true

  45. To Do • Read Section 8.1 (we are skipping 8.2) • Do Homework 6 (due Monday, 3/24)

More Related