1 Notes for M 384E, Wedesday, Jauary 21, 2009 (Please ote: I will ot pass out hard-copy class otes i future classes. If there are writte class otes, they will be posted o the web by the ight before class for you to dowload yourself.) This is a itroductory course i Aalysis of Variace ad Desig of Experimets. I. BRIEF OVERVIEW Questios: 1. What is Aalysis of Variace? 2. How is Aalysis of Variace coected to Desig of Experimets? Brief Aswers: 1. Aalysis of Variace (ANOVA) is a methodology that ca be used for statistical iferece i a variety of situatios geeralizig the equal-variace two-sample t-test. 2. The details of implemetatio of ANOVA deped o the desig of the method for collectig data -- typically, by a experimet. The desig eeds to take ito accout the methods of aalysis as well as the particulars of the cotext (the questio of iterest, factors that may ifluece the variable of iterest, ad costraits such as time ad budget.) II. MODEL ASSUMPTIONS FOR STATISTICAL PROCEDURES Statistical procedures typically have certai model assumptios. These are assumptios about the distributios of radom variables ivolved, or about how samples are chose, or about the type of relatioship betwee the variables ivolved. The essece of applyig statistics is to fid a model that does all of the followig: 1. Fits the real-word situatio ivolved well eough. 2. Leads to a valid method of statistical aalysis. 3. Gives iformatio relevat to the questios of iterest. I usig statistics, always bear i mid the words of the statisticia G.E. Box: All models are wrog; some are useful. This meas that models ever fit the real-world situatio exactly, but we eed to be sure that they fit "well eough" ad that they give relevat iformatio. III. REVIEW OF THE EQUAL VARIANCE TWO-SAMPLE T-TEST (focusig o the model assumptios ad why they are importat.)
2 (Note: There is aother two-sample t-test that does ot assume equal variace. However, the equal variace test is the oe we will be cocered with here, sice it is the oe that geeralizes to the Aalysis of Variace method.) Be sure to review the hadout Review of Basic Statistical Cocepts if you are cofused about otatio or basic cocepts used below. I discussig the equal variace two-sample t-test, we will focus o the model assumptios ad why they are importat for good applicatio of the method. Model Assumptios for the equal variace two-sample t- test: 1. x 1, x 2,, x m ad y 1, y 2, y are idepedet, radom samples from radom variables X ad Y. 2. X ad Y are each ormally distributed. 3. X ad Y have the same variace (which is ot kow) Deote the meas of X ad Y by µ X ad µ Y, respectively. (These are populatio meas, ot to be cofused with sample meas x ad y ) We wish to test the ull hypothesis agaist the two-sided alterative H 0 : µ X = µ Y H a : µ X µ Y Example: A large compay is plaig to purchase a large quatity of computer packages desiged to teach a ew programmig laguage. A cosultat claims that the two packages are equal i effectiveess. To test this claim, the compay radomly selects 60 egieers ad radomly assigs 30 to use the first package ad 30 to use the secod package. Each egieer is give a stadardized test of programmig skill after completig the traiig with the assiged package. The scores of the 30 egieers assiged to the first package are x 1, x 2,, x m ; the scores of those assiged to the secod package are y 1, y 2, y. (I this example, = m = 30.) The radom variable X is "test score of a egieer from this compay usig the first package." The radom variable Y is "test score of a egieer from this compay usig the secod package". Sice the egieers are radomly chose ad radomly assiged to the package, assumptio (1) is satisfied. Sice the test, like most stadardized tests, is devised ad scored to have a ormal distributio of scores, assumptio (2) is reasoable. It is plausible (we hope) to assume that the variability i scores will ot deped o the package chose, so assumptio (3) seems reasoable (although perhaps we might wat to look the data to get a additioal check o whether this assumptio is reasoable). Outlie of what the test ivolves ad why it works (focusig o where the model assumptios are eeded): (For more details, see Ross, Sectio 4.2 or Wackerly Sectio 10.8) Deote the (ukow) variace of X ad Y by σ 2.
3 Notatio: The otatio X ~ N(µ X, σ 2 ) is short for "the radom variable X is ormally distributed with mea µ X ad variace σ 2 ". Thus from our assumptios: X ~ N(µ X, σ 2 ) ad Y ~ N(µ Y, σ 2 ) From our sample y 1, y 2, y, we ca calculate the sample mea y, which is our best estimate of the mea µ Y. We could also calculate the sample mea for ay radom sample of size chose from Y. This process ("take a radom sample of size from Y ad calculate its sample mea") describes a ew radom variable, which we will call Y. Thus, y is the value of the radom variable Y obtaied by pickig our particular sample. Sice Y is a radom variable, it has a distributio (called a samplig distributio, sice the value of Y depeds o the sample chose). Mathematical theory tells us that the radom variable Y is ormally distributed with mea µ Y ad variace σ 2 /: Y ~ N(µ Y, σ 2 /) This coclusio uses the followig facts (or assumptios, as the case may be): y 1, y 2, y is a radom sample Y ~ N(µ Y, σ 2 ). Similarly (give the model assumptios), X ~ N(µ X, σ 2 /m) Our hypotheses ca be restated i terms of the differece µ X - µ Y : H 0 : µ X - µ Y = 0 H a : µ X - µ Y 0 Thus we cosider the differece x - y as a estimate of µ X - µ Y. I the laguage of radom variables, X - Y is a estimator of µ X - µ Y. Sice our samples from X ad Y are idepedet, the radom variables X ad Y are also idepedet. Mathematical theory tells us that: 1. The sum of idepedet ormal radom variables is ormal (so we kow that X - Y is ormal). 2. The mea (expected value) of the sum of radom variables is the sum of the meas of the terms (so we kow that the mea of X - Y is µ X - µ Y ). 3. The variace of the sum or differece of idepedet radom variables is the sum of the variaces of the terms (so we kow that Var( X - Y ) = Var( X ) + Var(Y ) = σ 2 /m + σ 2 /). Thus we have: X - Y ~ N(µ X - µ Y, σ 2 /m + σ 2 /). Therefore X "Y " (µ X "µ Y ) # 2 m + # 2 ~ N(0,1) (i.e., is stadard ormal).
4 If we kew σ 2, this would give us a test statistic to do iferece o µ X - µ Y. But we do't kow σ 2. We do, however, have two estimates of σ 2 : the two sample variaces m (x s 2 X = i " x ) # 2 ad s 2 Y = m "1 # (y i " y ) 2 "1 Cosistetly with our otatio y ad Y above, we will use capital letters to refer to the uderlyig radom variables (the estimators of σ 2 ): m (X S X2 = i " X ) # 2 ad S Y2 = m "1 # (Y i "Y ) 2 "1 Which of these two estimators should we use? What seems better tha pickig oe or the other is takig their average. But sice they are come from possibly differet sized samples, we use their weighted mea, yieldig the pooled estimator S 2 = (m "1)S 2 2 x + ( "1)S Y (m "1) + ( "1) = 1 $ m #(x m + "2 i " x ) 2 ' & + #(y i " y ) 2 ) %& (). So we cosider the radom variable T = X "Y " (µ "µ ) X Y S 2 m + S 2 Mathematical theory (usig the model assumptios) tells us that T has a t-distributio with + m -2 degrees of freedom. If H 0 is true, the T is just X "Y S 2 m + S 2 = X "Y S 1 m + 1. Summarizig: If H 0 is true, the the radom value T = X "Y S 1 m + 1 has a t-distributio with + m - 2 degrees of freedom. We ca use this fact to perform our hypothesis test: Calculate the value t of T determied by our sample. Calculate the correspodig p- value: p = the probability of obtaiig a value of T (havig a t-distributio with + m + 2 degrees of freedom) with absolute value greater tha or equal to t. If p is sufficietly small, we choose to reject the ull hypothesis i favor of the alterate. Note that this is ot the same as sayig H a is true, ad is also ot the same as sayig
5 that H 0 is false; it just says that H a appears to be the better optio, give the evidece at had. Otherwise, we do ot reject H 0 -- the evidece is cosistet with it. Note that this is ot the same as sayig that H 0 is true, ad it is also ot the same as sayig H a is false; it s just sayig that there is o reaso to prefer H a to H 0, give the evidece at had. Example: Cotiuig with the example of comparig the two packages for teachig a ew programmig laguage, if we obtai sample mea 72.5 ad sample stadard deviatio 10.3 for the first method, ad sample mea ad stadard deviatio 70.1 ad 11.8, respectively, for the secod method, the the pooled sample variace is s 2 = [29(10.3 2 ) + 29(11.8 2 )]/58 = 122.665, so the pooled stadard deviatio is s = (122.665) = 11.075, the pooled stadard error (which is our estimate of the stadard error of the radom variable X - Y ) is se( x - y ) = s 1 30 + 1 30 = 2.86 ad the t-statistic is 72.5 " 70.1 1 11.075 30 + 1 30 = 2.4/2.86 =.8392 The correspodig p-value (two-tailed, usig a t-distributio with 58 degrees of freedom) is 0.404825. This does ot give us ay evidece agaist the ull hypothesis, so we have ot detected ay sigificat differece betwee the two packages -- we have o reaso, based o the test scores, to choose oe over the other. We could also use the t-statistic to calculate a cofidece iterval for the differece µ X - µ Y i the sample meas. Suppose we wat a 90% cofidece iterval. For a t-distributio with 58 degrees of freedom, 90% of all values lie betwee - 1.67155 ad + 1.67155. So for 90% of all samples satisfyig the model assumptios, I other words, - 1.67155 < T < 1.67155. - 1.67155 < (X "Y ) "(µ X "µ Y ) se(x "Y ) < 1.67155.
6 A bit of algebra maipulatio shows that this is equivalet to ( X - Y ) - 1.67155se( X - Y ) < µ X - µ Y < ( X - Y ) + 1.67155se( X - Y ). Evaluatig this for our sample gives the edpoits (72.5-70.1) ± 1.67155(2.86) for the cofidece iterval, resultig i cofidece iterval ( -2.38, 7.18). Note that we are ot assertig that µ X - µ Y lies i this iterval. All we have doe is use a procedure that, for 90% of all pairs of simple radom samples of sizes, chose idepedetly from the populatios i questio, will give a iterval that does cotai µ X - µ Y. Our sample could be oe of the 10% yieldig a cofidece iterval that does ot cotai µ X - µ Y. Note also that the cofidece iterval cotais zero. Thus our data are cosistet with the possibility that µ X - µ Y = 0 -- i other words, that µ X = µ Y. (Note that this is the same coclusio we drew from the hypothesis test. ) Refereces: Ross, Sheldo M., Itroductio to Probability ad Statistics for Egieers ad Scietists, Wiley, 1987 Wackerly, Deis, William Medehall ad Richard Scheafer, Mathematical Statistics with Applicatios, Duxbury, 1996