Math 308 Sprig 018 Classes 19 ad 0: Aalysis of Variace (ANOVA) Page 1 of 6 Itroductio ANOVA is a statistical procedure for determiig whether three or more sample meas were draw from populatios with equal meas. I everyday laguage, ANOVA tests the ull hypothesis that the populatio meas (estimated by the sample meas) are all equal. If this ull hypothesis is reected, the we coclude that the populatio meas are ot all equal. A more precise formulatio of the ull ad alterative hypotheses for comparig meas is: H0 : 1... H : 1 at least oe pair of meas is differet, i, i, 1,..., ; i Because it tests for differeces betwee multiple pairs of meas i oe test, it is called a omibus test. Motivatio for ANOVA: You may as, Why do t we ust test if the meas are equal with t-tests? After all, we ow about t-tests. The problem with t-tests o eve three sample meas is that the t-tests are ot idepedet because you use each mea more tha oce. Cosider a simple example. Example 1: A chemical egieer must decide betwee 3 catalysts i terms of reactio completio times. The chemical egieer taes three samples, each with 5 completio times. If she tries to mae ifereces about the populatio meas usig t-tests o the three sample meas, she will use each sample mea twice: x1vs x, x1vs x3ad x vs x 3. Because she used each sample mea i two t-tests the t-tests are ot idepedet ad, therefore, she caot ow the probability of a Type I error. Recall that a Type I error is reectig oe of the three ull hypotheses whe it is true. Clearly, the situatio becomes worse whe we compare more tha three meas. Ca you thi of a way to remedy this situatio? Problem: Iflatio of Type I error with multiple t-tests. Oe remedy is to use ANOVA. The ull hypothesis of ANOVA assumes that all meas are equal. This is equivalet to statig that all samples were tae from the same populatio. The ANOVA test elimiates the problem of multiple t-tests o the same sample meas by testig all the meas at oce to see if ay of the meas are differet. If we reect the ull hypothesis, all we ow is that at least oe pair of meas is differet. We caot tell which pair of meas is differet util we ru a multiple compariso test. Solutio: Completely Radomized Desigs (also called Oe-Way ANOVA or a sigle-factor ANOVA).Example : A miig egieer wishes to compare five strais of bacteria with respect to mea copper yield (lb/to).
Math 308 Sprig 018 Classes 19 ad 0: Aalysis of Variace (ANOVA) Page of 6 Example 3: A chemical egieer assesses the effect of four pressure settigs o product yield (grams/liter). Pressure (i grams/liter) Sample Batch Low (1) Moderate () Strog (3) High (4) 1 8 30 31 9 6 9 9 7 3 9 30 33 30 4 30 30 33 31 5 8 8 9 7 6 31 3 33 3 7 6 9 8 7 8 3 3 3 3 9 5 8 7 7 10 9 30 3 30 The hypothesis-testig procedure for ANOVA 1. We formulate a ull hypothesis ad a appropriate alterative hypothesis. Cosider the sigle-factor ANOVA model for a sigle factor with 4 levels, such as the four differet pressure settigs i Example B. Each populatio mea may be represeted as: 4 1. B, where. is the populatio mea of the product yield at the four 4 product settigs ad B is the effect of pressure settig. Note that B may be positive if a pressure settig icreases product yield over the mea settig or egative if a product settig decreases product yield. Uder the ull hypothesis, B 0 for each. The sigle-factor ANOVA ull hypothesis for our example, H0 : 1 3 4, icludes the assumptio that the variaces are equal; so, the ull hypothesis is equivalet to assumig that all samples were draw from a oe populatio distributed as N(, ). Uder this assumptio we ow that the stadard error of the sample meas is. Cosequetly, we ow how the sample meas should be X distributed if the samples are draw from a sigle populatio or idetical populatios. Assumptios of sigle-factor ANOVA: 1. The depedet variable is ormally distributed.. Each populatio has the same or equal variace (homogeeity of variace). The factor has equal variaces at all levels of the factor. 3. A o-mathematical assumptio is that the samples represet idepedet radom samples.
Math 308 Sprig 018 Classes 19 ad 0: Aalysis of Variace (ANOVA) Page 3 of 6. We specify the probability of Type I error, P(Type I error). P(Type I error) is usually set at 0.05 or 0.01. 3. Based o the samplig distributio of a appropriate statistic, we costruct a criterio for testig the ull hypothesis agaist the give alterative. The F-statistic is used to compare the variability displayed by the sample meas (the amog-sample treatmet variace) to the variability displayed withi the samples (the withi-sample error variace). The form of the test or observed F-statistic is MSTreatmet F. MS error The distributio of the F-statistic is geerated from the ull hypothesis which assumes that all samples were tae from equivalet populatios. Note that the umerator of the F statistic estimates the variace of the mea. We ow that the variace of the mea is a fuctio of the variace of X:. The deomiator estimates the variace of X X iside the samples divided by the sample size:. So, the umerator ad the deomiator estimate the variace of the mea usig two differet sample statistics. So, if the ull hypothesis is true, the F value should radomly vary aroud the value 1. If the ull hypothesis is NOT TRUE, the umerator will ot be a good estimate of the variace of the mea ad will be larger tha 1. So, if the variability amog the sample meas is greater tha the variability withi the samples, the F is larger tha the critical value ad the ull hypothesis is reected. I that case we coclude that there is at least oe pair of populatio meas that are ot equal. Criterio or decisio rule: For the oe-factor ANOVA, the degrees of freedom for the umerator of the F statistic v1 1 ad the degrees of freedom for the deomiator v T c, where T is the sum of all sample sizes. The F-test is always a oe-sided test. We reect the ull hypothesis oly if the obtaied F value is too large. This meas that the differeces betwee the sample meas are too large for all the sample meas to represet the sigle mea of oe populatio. 4.We calculate from the data the value of the (obtaied) F statistic. ANOVA Table. A ANOVA table is used to calculate a F statistic. Here is a summary of relevat otatio. = umber of groups (samples from distict populatios) i = sample size of ith group N = sum of the sample sizes (total umber of observatios) x i = mea of ith sample x = grad mea or mea of all observatios s i = stadard deviatio of ith sample
Math 308 Sprig 018 Classes 19 ad 0: Aalysis of Variace (ANOVA) Page 4 of 6 v 1 = df treatmet = -1 = degrees of freedom amog sample meas v = df error = - =degrees of freedom withi samples SS treatmet = SS error = i ( xi - x ) (treatmet sum of squares amog sample meas) ( i -1)s i (error sum of squares withi samples) If you already have the sample variace, the followig formula is much easier to use. SS total = i 1 ( xi x) = SS treatmet + SS error MS treatmet = SS treatmet /(-1) = mea square amog sample meas MS error = SS error /(-) = mea square withi samples F = MS amog / MS withi The p-value is the probability of a F as large or larger tha the oe obtaied. 5. We decide to reect the ull hypothesis or fail to reect it. Decisio: We reect or FTR the ull hypothesis H0 : 1 3 4 at the specified α level by usig the decisio rule. Example 3: 1. Hypotheses: The ull hypothesis for comparig = 4 meas is: H :... 0 1 4 : 1 H at least oe pair of meas is differet, i. P(Type I error) ad Test Statistic: The egieer chose α = 0.05. Assumptios for the F statistic: The egieer had evidece that larger samples at various pressures displayed symmetric histograms; so, the assumptio of ormality seemed appropriate. Note: The sample stadard deviatios may vary by a factor of without producig ivalid results; so, give the stadard deviatios i a table for step 4, the assumptio of homogeeity of variaces seems reasoable. The egieer, therefore, chose the F statistic. 3. Decisio rule: The F for v 1 = 4-1 =3 ad v = 40 4 = 36 degrees of freedom for α = 0.05 is.86. The egieer s decisio rule is to reect the ull hypothesis if the obtaied F >.86. (Note that I foud the umber.86 i a table which icludes v = 36. Usig a table which preset v i icremets of 10, the closest you could come to the correct criterio F is by fidig the critical F value for v 1 = 3 ad v = 30. (Why ot 40?) This value is.9. Note that this will be coservative i the sese that a obtaied F of.87 will ot be reected for degrees of freedom 3 ad 30, but will be (correctly) reected for degrees of freedom 3 ad 36.)
Math 308 Sprig 018 Classes 19 ad 0: Aalysis of Variace (ANOVA) Page 5 of 6 4. Calculate F value. Note: I displayed oly the first three decimal places i this example. I actually stored the stadard deviatios i the memory of my calculator at greater precisio. Therefore, if you wor through this example, you may differ from my aswers begiig i the hudredths place. Recall that the formula for the sample stadard deviatio is: 1 1 s X X X X 1 1 ( i ) ( i ) Pressure Mea Yield N Std. Deviatio 1.00 8.400 10.706.00 9.800 10 1.3984 3.00 30.700 10.63 4.00 9.00 10.0976 Total 9.55 40.136 SS treatmet = i ( xi - x ) = 10[(8.4 9.55) (9.8 9.55) (30.7 9.55) (9. 9.55) ] SS error = = 8.75 ( i -1)s i = 9[.706 1.3984.63.0976 ] 149.700 MS treatmet = SS treatmet /(-1)= 8.75/(4-1)= 9.45 MS error = SS error /(N-)= 149.700/(40-4)= 4.158 F = MS amog / MS withi = 9.45/4.158 =.67 ANOVA Table for Example 3 Sum of Squares df Mea Square F Treatmets 8.75 3 9.45.67 Error 149.700 36 4.158 Total 177.975 39 5. Decisio: We FTR the ull hypothesis H0 : 1 3 4 at α=0.05 because the obtaied F.67 is less tha.86. Note that computer programs give you a p-value. Usig the p-value, you reect the ull hypothesis if the obtaied p-value is less tha or equal to 0.05. I our example the obtaied p-value is greater tha 0.05; so, we FTR the ull hypothesis. Multiple comparisos. If we reect the ull hypothesis, the how do we fid out which meas are differet? Note that we use multiple compariso tests oly after we have reected the ull hypothesis i the F test. There are may approaches to multiple compariso tests, may of them very techical. The Boferroi method is based o adusted probabilities. If you, experimeter, have meas to ( 1) compare, the there possible two-sample t-tests. So, the Boferroi method
Math 308 Sprig 018 Classes 19 ad 0: Aalysis of Variace (ANOVA) Page 6 of 6 uses istead of for the two-sided t-tests. For the Boferroi method, we actually do ( 1) all the t-tests but we use the modified value for probability of a Type I error. As stated previously, there are may differet types of multiple compariso ad follow-up tests. The Boferroi method is a respected method ad it follows from the treatmet of probability i this course Boferroi method of followig up reectio of the Null Hypothesis i ANOVA The Boferroi obtaied statistic is MS x x i error 1 1 ( ) i, i, i, 1,,...,. The critical t is obtaied by usig a two-tailed t test at the level ( 1). So for the ( 1) two-tailed test with the degrees of freedom=-, the degrees of freedom for the MS error.