Serk Sagtov, Chalmers and GU, February 0, 018 Chapter 1. Analyss of varance Chapter 11: I = samples ndependent samples pared samples Chapter 1: I 3 samples of equal sze one-way layout two-way layout 1 One-way layout Consder I ndependent IID samples (Y 11,..., Y 1 ),..., (Y I1,..., Y I ) measurng I treatment results. We have one man factor (factor A havng I levels) as the prncple cause of varaton n the data. The goal s to test H 0 : all I treatments have the same effect, vs H 1 : there are systematc dfferences. Data: 70 measurements of chlorphenramne maleate n tablets wth a nomnal dosage of 4 mg. Seven labs made ten measurements each: I = 7, = 10. Normal theory model Lab 1 3 7 5 6 4 Mean 4.06 4.003 3.998 3.997 3.957 3.955 3.90 Normally dstrbuted observatons Y j N(µ, σ ) wth equal varances (compare to the t-tests). In other words, Y j = µ + α + ɛ j, α = 0, ɛ j N(0, σ ), meanng: obs = overall mean + dfferental effect + nose. Sample means as maxmum lkelhood estmates Ȳ. = 1 Y j, Ȳ.. = 1 Y. = 1 Y j, I I j j ˆµ = Ȳ.., ˆµ = Ȳ., ˆα = Ȳ. Ȳ.., ˆα = 0, so that Y j = ˆµ + ˆα + ˆɛ j, where ˆɛ j = Y j Ȳ. are the so-called resduals Decomposton of the total sum of squares: SS T = SS A + SS E. SS T = j (Y j Ȳ..) total sum of squares for the pooled sample wth df T = I 1, SS A = ˆα factor A sum of squares (between-group varaton) wth df A = I 1, SS E = j ˆɛ j error sum of squares (wthn-group varaton) wth df E = I( 1). Mean squares and ther expected values MS A = SS A df A, E(MS A ) = σ + I 1 = SS E df E, E( ) = σ. α, 1
One-way F -test Pooled sample varance s p = = s an unbased estmate of σ. Use F = MS A 1 I( 1) (Y j Ȳ.) as test statstc for H 0 : α 1 =... = α I = 0 aganst H 1 : α u α v for some (u, v). Reject H 0 for large values of F, snce E H0 (MS A ) = σ and E H1 (MS A ) = σ + I 1 j α > σ. Null dstrbuton F F n1,n wth degrees of freedom n 1 = I 1 and n = I( 1). If X 1 χ n 1 and X χ n are two ndependent random varables, then X 1/n 1 X /n F n1,n. The normal probablty plot of resduals ˆɛ j supports the normalty assumpton. Nose sze σ s estmated by s p = 0.0037 = 0.061. One-way Anova table Source df SS MS F P -value Labs 6.15.010 5.66.0001 Error 63.31.0037 Total 69.356 Whch of the ( 7 ) = 1 parwse dfferences are sgnfcant? Usng the 95% CI for a sngle par of ndependent samples (µ u µ v ) we get (Ȳu. Ȳv.) ± t 63 (0.05) sp = (Ȳu. Ȳv.) ± 0.055, 5 where t 63 (0.05) =.00. Ths formula yelds 9 sgnfcant dfferences: Labs 1 4 1 6 1 5 3 4 7 4 4 1 1 7 1 3 5 4 Dff 0.14 0.107 0.105 0.083 0.078 0.077 0.065 0.064 0.059 0.047 The multple comparson problem: the above CI formula s amed at a sngle dfference, and may produce false dscoveres. We need a smultaneous CI formula for all 1 parwse comparsons. Bonferron method Thnk of k ndependent replcatons of a statstcal test. The overall result s postve f we get at least one postve result among these k tests. The overall sgnfcance level α s obtaned, f each sngle test s performed at sgnfcance level α/k: ndeed, assumng the null hypothess s true, the number of postve results s X Bn(k, α k ), and due to ndependence P(X 1 H 0 ) = 1 (1 α k )k α for small values of α. Smultaneuos 100(1 α)% CI formula for ( I ) parwse dfferences (µu µ v ):
(Ȳu. Ȳv.) α ± t I( 1) ( I(I 1) ) s p Flexblty of the formula: works for dfferent sample szes as well after replacng by Warnngs: ( I ) parwse Anova comparsons are not ndependent as requred by Bonferron method, Bonferron method gves narrower ntervals compared to the Tukey method. 1 u + 1 v. The Bonferron smultaneuos 95% CI for (α u α v ) (Ȳu. Ȳv.) ± t 63 (.05) sp 4 5 = (Ȳu. Ȳv.) ± 0.086, where t 63 (0.001) = 3.17, detects 3 sgnfcant dfferences between labs (1,4), (1,5), (1,6). Tukey method If I ndependent samples (Y 1,..., Y ) taken from N(µ, σ ) have the same sze, then the sample means Ȳ. N(µ, σ ) are ndependent. Consder the range of dfferences between (Ȳ. µ ): Then we get R(I; ) = max{ȳ1. µ 1,..., ȲI. µ I } mn{ȳ1. µ 1,..., ȲI. µ I }. R(I; ) s p / SR(I, I( 1)), where the so-called studentzed range dstrbuton SR(k, df) has two parameters: the number of samples k, and the number of degrees of freedom used n the varance estmate s p. Tukey s 95% smultaneuos CI = (Ȳu. Ȳv.) ± q I,I( 1) (0.05) sp Usng q 7,60 (0.05) = 4.31 from the SR-dstrbuton table, we fnd four sgnfcant parwse dfferences: (1,4), (1,5), (1,6), (3,4), snce (Ȳu. Ȳv.) ± q 7,63 (0.05) 0.061 10 = (Ȳu. Ȳv.) ± 0.083. Kruskal-Walls test A nonparametrc test, wthout assumng normalty, for H 0 : all observatons are equal n dstrbuton, no treatment effects. Extendng the dea of the rank-sum test, consder the pooled sample of sze N = I. Let R j be the pooled ranks of the sample values Y j, so that j R j = N(N+1) and R.. = N+1 s the mean rank. Kruskal-Walls test statstc K = 1 I N(N+1) =1 ( R. N+1 ) 3
Reject H 0 for large K usng the null dstrbuton table. For I = 3, 5 or I 4, 4, use the approxmate null dstrbuton K a χ I 1. In the table below the actual measurements are replaced by ther ranks 1 70. Wth the observed test statstc K = 8.17 and df = 6, usng χ 5-dstrbuton table we get a P-value 0.0001. Two-way layout Labs 1 3 4 5 6 7 70 4 35 6 46 48 38 63 3 45 7 1 5 50 53 65 40 13 47 5 64 69 41 0 8 8 58 59 66 57 16 14 37 68 54 39 3 6 4 1 43 44 51 17 9 31 15 61 56 5 11 10 34 3 67 4 9 7 33 49 60 55 19 30 1 36 18 6 Means 58.9 38.9 38.5 15.5 6.6 7.4 4.7 Suppose the data values are nfluenced by two man factors and a nose: Y jk = µ + α + β j + δ j + ɛ jk, = 1,..., I, j = 1,...,, k = 1,..., K, grand mean + man A-effect +man B-effect + nteracton + nose. Factor A has I levels, factor B has levels, and we have K observatons for each combnaton (, j). Normal theory model Key assumpton: all nose components ɛ jk N(0, σ ) are ndependent and have the same varance. Parameter constrants and numbers of degrees of freedom df A = I 1, because α = 0, df B = 1, because j β j = 0, df AB = I I + 1 = (I 1)( 1), because δ j = 0, j δ j = 0. Maxmum lkelhood estmates: ˆµ = Ȳ..., ˆα = Ȳ.. Ȳ..., ˆβj = Ȳ.j. Ȳ..., ˆδ j = Ȳj. Ȳ... ˆα ˆβ j = Ȳj. Ȳ.. Ȳ.j. + Ȳ..., and the resduals ˆɛ jk = Y j. Ȳjk. Example (ron retenton) Raw data X jk s the percentage of ron retaned n mce. Factor A: I = ron forms, factor B: = 3 dosage levels, K = 18 observatons for each (ron form, dosage level) combnaton. From the graphs we see that the raw data s not normally dstrbuted. However, the transformed data Y jk = ln(x jk ) produce more satsfactory graphs. The sample means and maxmum lkelhood estmates for the transformed data 4
( ) 1.16 1.90.8 (Ȳj.) = two rows produce two profles: not parallel - possble nteracton, 1.68.09.40 Ȳ... = 1.9, ˆα 1 = 0.14, ˆα = 0.14, ( ) 0.1 0.04 0.08 ˆβ 1 = 0.50, ˆβ = 0.08, ˆβ3 = 0.4, (ˆδ j ) = 0.1 0.04 0.08 Sums of squares SS T = j k (Y jk Ȳ...) = SS A + SS B + SS AB + SS E, df T = IK 1 SS A = K ˆα, df A = I 1, MS A = SS A df A, E(MS A ) = σ + K I 1 α j β j SS B = IK ˆβ j, df B = 1, MS B = SS B df B, E(MS B ) = σ + IK 1 SS AB = K j δ j, df AB = (I 1)( 1), MS AB = SS AB df AB, E(MS AB ) = σ + SS E = j k (Y jk Ȳj.), df E = I(K 1), = SS E df E, E( ) = σ Three F -tests Pooled sample varance s p = s an unbased estmate of σ. K (I 1)( 1) j δ j Null hypothess No-effect property Test statstcs and null dstrbuton H A : α 1 =... = α I = 0 E(MS A ) = σ F A = MS A F dfa,df E H B : β 1 =... = β = 0 E(MS B ) = σ F B = MS B F dfb,df E H AB : all δ j = 0 E(MS AB ) = σ F AB = MS AB F dfab,df E Reject null hypothess for large values of the respectve test statstc F. Inspect normal probablty plot for the resduals ˆɛ jk. Example (ron retenton) Two-way Anova table for the transformed ron retenton data. Dosage effect was expected from the begnnng. Interacton s not sgnfcant. Source df SS MS F P Iron form 1.074.074 5.99 0.017 Dosage 15.588 7.794.53 0.000 Interacton 0.810 0.405 1.17 0.315 Error 10 35.96 0.346 Total 107 53.768 Sgnfcant effect due to ron form. Estmated log scale dfference ˆα ˆα 1 = Ȳ.. Ȳ1.. = 0.8 yelds the multplcatve effect of e 0.8 = 1.3 on a lnear scale. 3 Randomzed block desgn Blockng s used to remove the effects of a few of the most mportant nusance varables. Randomzaton s then used to reduce the contamnatng effects of the remanng nusance varables. Block what you can, randomze what you cannot. 5
Expermental desgn: randomly assgn I treatments wthn each of blocks. Test the null hypothess of no treatment effects usng the two-way layout Anova. The block effect s antcpated and s not of major nterest. Examples: Block Treatments Observaton A homogeneous plot of land I fertlzers each appled to The yeld on the dvded nto I subplots a randomly chosen subplot subplot (, j) A four-wheel car 4 types of tres tested on the same car tre s lfe-length A ltter of I anmals I dets randomly assgned to I snlngs the weght gan Addtve model If K = 1, then we cannot estmate nteracton. Ths leads to the addtve model wthout nteracton Y j = µ + α + β j + ɛ j. Maxmum lkelhood estmates ˆµ = Ȳ.., ˆα = Ȳ. Ȳ.., ˆβ = Ȳ.j Ȳ.., ˆɛ j = Y j Ȳ.. ˆα ˆβ = Y j Ȳ. Ȳ.j + Ȳ.. Sums of squares SS T = j (Ȳj Ȳ..) = SS A + SS B + SS E, df T = I 1 SS A = ˆα, df A = I 1, MS A = SS A df A SS B = I ˆβ j j, df B = 1 MS B = SS B SS E = df B F A = MS A F B = MS B j ˆɛ j, df E = (I 1)( 1) = SS E df E E( ) = σ Example (tchng) Data: the duraton of the tchng n seconds Y j, wth K = 1 observaton per cell, I = 7 treatments to releve tchng appled to = 10 male volunteers aged 0-30. F dfa,df E F dfb,df E Subject No Drug Placebo Papaverne Morphne Amnophyllne Pentabarbtal Trpelennamne BG 174 63 105 199 141 108 141 F 4 13 103 143 168 341 184 BS 60 31 145 113 78 159 15 SI 5 91 103 5 164 135 7 BW 165 168 144 176 17 39 194 TS 37 11 94 144 114 136 155 GM 191 137 35 87 96 140 11 SS 100 10 133 10 134 19 MU 115 89 83 100 165 185 79 OS 189 433 37 173 168 188 317 Boxplots ndcate volatons of the assumptons of normalty and equal varance. Notce much bgger varance for the placebo group. Two-way Anova table Source df SS MS F P Drugs 6 53013 8835.85 0.018 Subjects 9 10380 11476 3.71 0.001 Error 54 167130 3096 Total 69 334 6
Tukey s method of multple comparson q I,(I 1)( 1) (α) sp 3096 = q 7,54 (0.05) = 75.8 reveals only 10 one sgnfcant dfference: papaverne vs placebo wth 08.4 118. = 90. > 75.8. Fredman test Treatment 1 6 7 4 5 3 Mean 08.4 191.0 176.5 167. 148.0 144.3 118. Nonparametrc test, when ɛ j are non-normal, to test H 0 : no treatment effects. Rankng wthn j-th block: (R 1j,..., R Ij ) = ranks of (Y 1j,..., Y Ij ) so that R 1j +... + R Ij = I(I+1) mplyng 1(R I 1j +... + R Ij ) = I+1 and R.. = I+1. Test statstc Q = 1 I I(I+1) =1 ( R. I+1 ) has an approxmate null dstrbuton Q a χ I 1. Snce Q s a measure of agreement between rankngs, we reject H 0 for large values of Q. Example (tchng) From the values R j and R. below and I+1 = 4, we fnd the Fredman test statstc Q = 14.86. Usng the ch-square dstrbuton table wth df = 6 we obtan an approxmate P-value to be.14%. We reject the null hypothess of no effect even n the non-parametrc settng. Subject No Drug Placebo Papaverne Morphne Amnophyllne Pentabarbtal Trpelennamne BG 5 7 1 6 3.5 3.5 F 6 5 1 3 7 4 BS 7 6 4 1 5 3 SI 6 7 1 4 3 5 BW 3 4 5 1 7 6 TS 7 3 1 5 4 6 GM 7 5 1 3 6 4 SS 1 5 3 7 6 4 MU 5 3 4 6 7 1 OS 4 7 5 1 3 6 R. 5.10 4.90.30 3.50 3.05 4.90 4.5, 7