Lecture notes 13: ANOVA (a.k.a. Analysis of Variance)

Slides:



Advertisements
Similar presentations
BPS - 5th Ed. Chapter 241 One-Way Analysis of Variance: Comparing Several Means.
Advertisements

Analysis of Variance (ANOVA) ANOVA can be used to test for the equality of three or more population means We want to use the sample results to test the.
1 1 Slide © 2011 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole.
ANOVA: Analysis of Variation
© 2010 Pearson Prentice Hall. All rights reserved Single Factor ANOVA.
1 1 Slide © 2009, Econ-2030 Applied Statistics-Dr Tadesse Chapter 10: Comparisons Involving Means n Introduction to Analysis of Variance n Analysis of.
Analysis of Variance: Inferences about 2 or More Means
ANOVA Single Factor Models Single Factor Models. ANOVA ANOVA (ANalysis Of VAriance) is a natural extension used to compare the means more than 2 populations.
Chapter 12: Analysis of Variance
F-Test ( ANOVA ) & Two-Way ANOVA
1 1 Slide © 2003 South-Western/Thomson Learning™ Slides Prepared by JOHN S. LOUCKS St. Edward’s University.
HAWKES LEARNING SYSTEMS math courseware specialists Copyright © 2010 by Hawkes Learning Systems/Quant Systems, Inc. All rights reserved. Chapter 14 Analysis.
ANOVA Greg C Elvers.
1 1 Slide © 2006 Thomson/South-Western Slides Prepared by JOHN S. LOUCKS St. Edward’s University Slides Prepared by JOHN S. LOUCKS St. Edward’s University.
1 1 Slide © 2005 Thomson/South-Western Chapter 13, Part A Analysis of Variance and Experimental Design n Introduction to Analysis of Variance n Analysis.
1 1 Slide © 2008 Thomson South-Western. All Rights Reserved Chapter 13 Experimental Design and Analysis of Variance nIntroduction to Experimental Design.
1 1 Slide Analysis of Variance Chapter 13 BA 303.
12-1 Chapter Twelve McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc., All Rights Reserved.
PSY 307 – Statistics for the Behavioral Sciences Chapter 16 – One-Factor Analysis of Variance (ANOVA)
One-Factor Analysis of Variance A method to compare two or more (normal) population means.
ANOVA (Analysis of Variance) by Aziza Munir
Basic concept Measures of central tendency Measures of central tendency Measures of dispersion & variability.
1 Chapter 13 Analysis of Variance. 2 Chapter Outline  An introduction to experimental design and analysis of variance  Analysis of Variance and the.
Chapter 19 Analysis of Variance (ANOVA). ANOVA How to test a null hypothesis that the means of more than two populations are equal. H 0 :  1 =  2 =
Comparing Three or More Means ANOVA (One-Way Analysis of Variance)
Econ 3790: Business and Economic Statistics Instructor: Yogesh Uppal
Econ 3790: Business and Economic Statistics Instructor: Yogesh Uppal
Hypothesis test flow chart frequency data Measurement scale number of variables 1 basic χ 2 test (19.5) Table I χ 2 test for independence (19.9) Table.
Introduction to ANOVA Research Designs for ANOVAs Type I Error and Multiple Hypothesis Tests The Logic of ANOVA ANOVA vocabulary, notation, and formulas.
ANalysis Of VAriance can be used to test for the equality of three or more population means. H 0 :  1  =  2  =  3  = ... =  k H a : Not all population.
1/54 Statistics Analysis of Variance. 2/54 Statistics in practice Introduction to Analysis of Variance Analysis of Variance: Testing for the Equality.
1 1 Slide © 2008 Thomson South-Western. All Rights Reserved Slides by JOHN LOUCKS St. Edward’s University.
 List the characteristics of the F distribution.  Conduct a test of hypothesis to determine whether the variances of two populations are equal.  Discuss.
DSCI 346 Yamasaki Lecture 4 ANalysis Of Variance.
1 Pertemuan 19 Analisis Varians Klasifikasi Satu Arah Matakuliah: I Statistika Tahun: 2008 Versi: Revisi.
The 2 nd to last topic this year!!.  ANOVA Testing is similar to a “two sample t- test except” that it compares more than two samples to one another.
Chapter 15 Analysis of Variance. The article “Could Mean Platelet Volume be a Predictive Marker for Acute Myocardial Infarction?” (Medical Science Monitor,
Rancangan Acak Lengkap ( Analisis Varians Klasifikasi Satu Arah) Pertemuan 16 Matakuliah: I0184 – Teori Statistika II Tahun: 2009.
Chapter 13 Analysis of Variance (ANOVA). ANOVA can be used to test for differences between three or more means. The hypotheses for an ANOVA are always:
ANOVA: Analysis of Variation
Chapter 11 Created by Bethany Stubbe and Stephan Kogitz.
CHAPTER 3 Analysis of Variance (ANOVA) PART 1
Chapter 13 f distribution and 0ne-way anova
24. One-way ANOVA: Comparing several means
ANOVA: Analysis of Variation
ANOVA: Analysis of Variation
Testing the Difference between Means and Variances
ANOVA: Analysis of Variation
Statistics for Managers Using Microsoft Excel 3rd Edition
Characteristics of F-Distribution
i) Two way ANOVA without replication
Comparing Three or More Means
CHAPTER 3 Analysis of Variance (ANOVA)
Basic Practice of Statistics - 5th Edition
Statistical Data Analysis - Lecture10 26/03/03
Statistics Analysis of Variance.
Post Hoc Tests on One-Way ANOVA
Statistics for Business and Economics (13e)
Econ 3790: Business and Economic Statistics
Comparing Three or More Means
Chapter 11 Analysis of Variance
Comparing Three or More Means ANOVA (One-Way Analysis of Variance)
I. Statistical Tests: Why do we use them? What do they involve?
One-Way Analysis of Variance
Hypothesis Tests for a Standard Deviation
Chapter 10 – Part II Analysis of Variance
ANOVA: Analysis of Variance
Week ANOVA Four.
STATISTICS INFORMED DECISIONS USING DATA
Presentation transcript:

Lecture notes 13: ANOVA (a.k.a. Analysis of Variance) Outline: Testing for a difference in means Notation Sums of squares Mean squares The F distribution The ANOVA table Part II: multiple comparisons Worked example

Testing for a difference in more than two means Previously we have seen how to test for a difference in two means, using a 2 sample t-test. But what if we want to test to see if there are differences in a set of more than two means? The tool for doing this is called ANOVA, which is short for “analysis of variance”. With ANOVA, we test three or more “groups” to see if any of groups’ means differ significantly from the others.

How to detect differences in means: two cases In both of these cases, the sample means for the three boxplots are about 5, 10, and 15, respectively. In the first case, it seems clear that the true means must also differ. In the second case, this isn’t so clear.

In other words, did these three boxplots come from populations with the same mean, or with different means? or ?

Using variance to test for a difference in means The thing that makes these two cases so different is that in the first, the data is not very spread out, while in the second it is. More variation reflects greater uncertainty regarding the values of the true unknown means. With ANOVA, we compare average “between group” variance to average “within group” variance. “Between group” variance refers to how much the means of the groups vary from one another. “Within group” variance refers to how spread out the data is in each group.

Using variance to test for a difference in means If the average amount of variation between the groups is substantially larger than the average amount of variation within the groups, then the true group means likely differ. If not, then we cannot rule out that they are equal. As you might guess, we will make this decision using a hypothesis test. For ANOVA, we have: H0: the group means are all equal Ha: at least one group mean differs from the others

Group 1: access to chow only. Male lab rats were randomly assigned to 3 groups differing in access to food for 40 days. The rats were weighed (in grams) at the end. Group 1: access to chow only. Group 2: chow plus access to cafeteria food restricted to 1 hour every day. Group 3: chow plus extended access to cafeteria food (all day long every day). Cafeteria food: bacon, sausage, cheesecake, pound cake, frosting and chocolate Does the type of food access influence the body weight of male lab rats significantly? H0: µchow = µrestricted = µextended Ha: H0 is not true (at least one mean µ is different from at least one other mean µ) N Mean StDev Chow 19 605.63 49.64 Restricted 16 657.31 50.68 Extended 15 691.13 63.41

The ANOVA table All of the information regarding this ANOVA procedure can be summarized in an ANOVA table: Source of variation df Sum of squares Mean square F statistic Treatment k-1 SSTr MSTr = SSTr/(k-1) F = MSTr/MSE Error N-k SSE MSE = SSE/(N-k) Total N-1 SSTo

Notation We will be using the following notation in our calculations.

Sums of squares “Sums of squares” refers to sums of squared deviations from some mean. ANOVA compares “between” to “within” group variation, and these types of variation are quantified using sums of squares. The three important sums of squares we will consider are: SSTo: Total sums of squares SSTr: Treatment sums of squares SSE: Error sums of squares Here, SSTr quantifies between group variation, while SSE quantifies within group variation.

Total sum of squares Total sum of squares is calculated by summing up the squared deviations of every point in the data from the grand mean. This quantifies the amount of overall variation in the data, for all of the groups put together. The degrees of freedom associated with SSTo are

Treatment sum of squares Treatment sum of squares is calculated by summing the squared deviations of each sample mean from the grand mean. This quantifies how much the sample means vary. It is what we are referring to when we say “between group variation”. The degrees of freedom associated with SSTr are

Error sum of squares Error sum of squares is calculated by added up the squared deviations of each data point around its group mean. This quantifies how much the data varies around its group sample means. It is what we are referring to when we say “within group variation”. The degrees of freedom associated with SSE are

Putting the sums of squares together SSTo = SSTr+SSE In other words, we can express the total amount of variation as the sum of “between group variation” (SSTr) and “within group variation” (SSE).

Mean squares A mean square is a sum of squares, divided by its associated degrees of freedom. MSTr = mean square for treatments = MSE = mean square for errors = Mean squares quantify the average amount of variation. MSTr quantifies average variation between groups, while MSE quantifies average variation within groups.

The F distribution The statistic we will calculate is: This follows an F distribution, which is a ratio of two chi-square distributions. It looks like a chi-square distribution (skewed right). It has separate degrees of freedom for the numerator and for the denominator. If the population means are the same, then this statistic should be close to 1. If the population means are different then between group variation (MSTr) should exceed within group variation (MSE), producing an F statistic greater than 1.

Using Table F The F distribution is asymmetrical and has two distinct degrees of freedom. This was discovered by Fisher, hence the label "F". Once again what we do is calculate the value of F for our sample data, and then look up the corresponding area under the curve in Table F.

The F distribution To find a p-value based on an F statistic with your calculator, use Which in this case is

The ANOVA table All of the information regarding this ANOVA procedure can be summarized in an ANOVA table: Source of variation df Sum of squares Mean square F statistic Treatment k-1 SSTr MSTr = SSTr/(k-1) F = MSTr/MSE Error N-k SSE MSE = SSE/(N-k) Total N-1 SSTo

Assumptions of ANOVA The ANOVA procedure makes two main assumptions: i. The population distribution of each group is normal ii. The population standard deviations of each group __are equal. The ANOVA procedure is robust to mild departures from these assumptions. By this, we mean that the assumptions can be violated to some extent and the sampling distribution of the test statistic under the null hypothesis will still follow an F distribution.

Assumptions of ANOVA We cannot know for sure if our assumptions are met, but we can “eyeball” our data to make sure they aren’t being clearly violated. If the data look approximately normal around each mean, and no sample standard deviation is more than twice as big as another, we’re probably in good shape. There are formal ways to test if a set of data is significantly non-normal, or if standard deviations are significantly different from one another. We will not cover these in our class.

Example A researcher who studies sleep is interested in the effects of ethanol on sleep time. She gets a sample of 20 rats and gives each an injection having a particular concentration of ethanol per body weight. There are 4 treatment groups, with 5 rats per treatment. She records REM sleep time for each rat over a 24-period. The results are plotted below:

Set up hypotheses We’d like to use the ANOVA procedure to see if we have evidence that any of these means differ from the others. We’ll use a level of significance of 0.05. H0: Ha:

And here are the relevant summary statistics: First, we find the grand sample mean:

The ANOVA table Here is what we can fill out so far in the ANOVA table. The goal is to get all the information we need in order to compute the F statistic. Source of variation df Sum of squares Mean square F statistic Treatment 3 SSTr MSTr = SSTr/(3) F = MSTr/MSE Error 16 SSE MSE = SSE/(16) Total 19 SSTo

Calculate SSTr and SSE

Calculate SSTr and SSE

The ANOVA table Now we can update our ANOVA table with these sums of squares. Source of variation df Sum of squares Mean square F statistic Treatment 3 MSTr = SSTr/(3) F = MSTr/MSE Error 16 MSE = SSE/(16) Total 19

Calculate MSTr, MSE, and F

The ANOVA table Now we can finish filling in our ANOVA table Source of variation df Sum of squares Mean square F statistic Treatment 3 Error 16 Total 19

Compute the p-value Now we have to see if our F statistic is “big” enough in order to reject H0. We do this the usual way: by finding the area under the F-distribution to the right of the test statistic, i.e. by finding the p-value. Remember that the F distribution has both a numerator df and a denominator df. In this example, numerator df = 3 and denominator df = 16. In your calculator, you can compute:

Results This p-value is very small, so we reject H0 and conclude that at least one group’s average sleep time differs significantly from the others. Note that this overall ANOVA test does not identify which means differ from which other means. It only tells us that at least one is significantly different from at least one other.

Male lab rats were randomly assigned to 3 groups differing in access to food for 40 days. The rats were weighed (in grams) at the end. Does the type of access to food influence the body weight of lab rats significantly? Minitab One-way ANOVA: Chow, Restricted, Extended Source DF SS MS F P Factor 2 63400 31700 10.71 0.000 Error 47 139174 2961 Total 49 202573 S = 54.42 R-Sq = 31.30% R-Sq(adj) = 28.37% N Mean StDev Chow 19 605.63 49.64 Restricted 16 657.31 50.68 Extended 15 691.13 63.41

Male lab rats were randomly assigned to 3 groups differing in access to food for 40 days. The rats were weighed (in grams) at the end. Does the type of access to food influence the body weight of lab rats significantly? The test statistic is F = 10.71. Notice that when using a printed table such as Table F, the actual combination of degrees of freedom (numerator and denominator) might not be available. In such cases, you should look for the nearest smaller degrees of freedom available. Here we use df 2 and 25 in Table F as a conservative approximation to df 2 and 47. The F statistic (10.71) is large and the P-value is very small (<0.001). We reject H0.  The population mean weights are not all the same; food access type influences weight significantly in male lab rats.