Download One-Way Analysis of Variance (ANOVA) for Comparing Means of Multiple Groups and more Exams Statistics in PDF only on Docsity! 1-Way Analysis of Variance • Setting: – Comparing g > 2 groups – Numeric (quantitative) response – Independent samples • Notation (computed for each group): – Sample sizes: n1,...,ng (N=n1+...+ng) – Sample means: – Sample standard deviations: s1,...,sg ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ++ = N YnYn YYY gg g L11 1,..., 1-Way Analysis of Variance • Assumptions for Significance tests: – The g distributions for the response variable are normal – The population standard deviations are equal for the g groups (σ) – Independent random samples selected from the g populations Example: Policy/Participation in European Parliament i n_i Ybar_i s_i YBar_i-Ybar BSS WSS 1 205 296.5 124.7 -37.25 284450.313 3172218 2 88 357.3 93.0 23.55 48805.02 752463 3 8 449.6 171.8 115.85 107369.78 206606.7 4 133 368.6 61.1 34.85 161531.493 492783.7 602156.605 4624072 43044344624072)1.61)(1133()7.124)(1205( 3146.602156)75.3336.368(133)75.3335.296(205 22 22 =−==−++−= =−==−++−= W B dfWSS dfBSS L L F-Test for Equality of Means • H0: µ1 = µ2 = ⋅⋅⋅ = µg • HA: The means are not all equal )( :.. )/( )1/(.. ,1, obs gNgobs obs FFPP FFRR WMS BMS gNWSS gBSSFST ≥= ≥ = − − = −−α • BMS and WMS are the Between and Within Mean Squares Example: Policy/Participation in European Parliament • H0: µ1 = µ2 = µ3 = µ4 • HA: The means are not all equal 001.)42.5()67.18( 60.2:.. 67.18 430/4624072 3/6.602156 )/( )1/(.. 430,3,05.,1, =≥<=≥= ≈=≥ == − − = −− FPFFPP FFFRR gNWSS gBSSFST obs gNgobs obs α Multiple Comparisons of Groups • Goal: Obtain confidence intervals for all pairs of group mean differences. • With g groups, there are g(g-1)/2 pairs of groups. • Problem: If we construct several (or more) 95% confidence intervals, the probability that they all contain the parameters (µi-µj) being estimated will be less than 95% • Solution: Construct each individual confidence interval with a higher confidence coefficient, so that they will all be correct with 95% confidence Bonferroni Multiple Comparisons • Step 1: Select an experimentwise error rate (αE), which is 1 minus the overall confidence level. For 95% confidence for all intervals, αE=0.05. • Step 2: Determine the number of intervals to be constructed: g(g-1)/2 • Step 3: Obtain the comparisonwise error rate: αC= αE/[g(g-1)/2] • Step 4: Construct (1- αC)100% CI’s for µi-µj: ( ) ji gNji nn tYY C 11^ ,2/ +±− − σα Interpretations • After constructing all g(g-1)/2 confidence intervals, make the following conclusions: – Conclude µi > µj if CI is strictly positive – Conclude µi < µj if CI is strictly negative – Do not conclude µi ≠ µj if CI contains 0 • Common graphical description. – Order the group labels from lowest mean to highest – Draw sequence of lines below labels, such that means that are not significantly different are “connected” by lines Regression Approach To ANOVA • Dummy (Indicator) Variables: Variables that take on the value 1 if observation comes from a particular group, 0 if not. • If there are g groups, we create g-1 dummy variables. • Individuals in the “baseline” group receive 0 for all dummy variables. • Statistical software packages typically assign the “last” (gth) category as the baseline group • Statistical Model: E(Y) = α + β1Z1+ ... + βg-1Zg-1 • Zi =1 if observation is from group i, 0 otherwise • Mean for group i (i=1,...,g-1): µi = α + βi • Mean for group g: µg = α Test Comparisons µi = α + βi µg = α ⇒ βi = µi - µg • 1-Way ANOVA: H0: µ1= … =µg • Regression Approach: H0: β1 = ... = βg-1 = 0 • Regression t-tests: Test whether means for groups i and g are significantly different: – H0: βi = µi - µg= 0 2-Way ANOVA • 2 nominal or ordinal factors are believed to be related to a quantitative response • Additive Effects: The effects of the levels of each factor do not depend on the levels of the other factor. • Interaction: The effects of levels of each factor depend on the levels of the other factor • Notation: µij is the mean response when factor A is at level i and Factor B at j ANOVA Approach General Notation: Factor A has a levels, B has b levels Source df SS MS F Factor A a-1 SSA MSA=SSA/(a-1) FA=MSA/WMS Factor B b-1 SSB MSB=SSB/(b-1) FB=MSB/WMS Interaction (a-1)(b-1) SSAB MSAB=SSAB/[(a-1)(b-1)] FAB=MSAB/WMS Error N-ab WSS WMS=WSS/(N-ab) Total N-1 TSS • Procedure: • Test H0: No interaction based on the FAB statistic • If the interaction test is not significant, test for Factor A and B effects based on the FA and FB statistics Example - Thalidomide for AIDS A Negative A Positive tb Placebo Thalidomide drug -2.5 0.0 2.5 5.0 7.5 w tg ai n A A A A A A A A A A A A A A A A A A A A A A Report WTGAIN 3.688 8 2.6984 2.375 8 1.3562 -1.250 8 1.6036 .688 8 1.6243 1.375 32 2.6027 GROUP TB+/Thalidomide TB-/Thalidomide TB+/Placebo TB-/Placebo Total Mean N Std. Deviation Individual Patients Group Means Placebo Thalidomide drug -1.000 0.000 1.000 2.000 3.000 m ea nw g A A A A Example - Thalidomide for AIDS Tests of Between-Subjects Effects Dependent Variable: WTGAIN 109.688a 3 36.563 10.206 .000 60.500 1 60.500 16.887 .000 87.781 1 87.781 24.502 .000 .781 1 .781 .218 .644 21.125 1 21.125 5.897 .022 100.313 28 3.583 270.500 32 210.000 31 Source Corrected Model Intercept DRUG TB DRUG * TB Error Total Corrected Total Type III Sum of Squares df Mean Square F Sig. R Squared = .522 (Adjusted R Squared = .471)a. • There is a significant Drug*TB interaction (FDT=5.897, P=.022) • The Drug effect depends on TB status (and vice versa) Example - Thalidomide for AIDS • Testing for a Thalidomide effect on weight gain: – H0: β1 = 0 vs HA: β1 ≠ 0 (t-test, since a-1=1) • Testing for a TB+ effect on weight gain: – H0: β2 = 0 vs HA: β2 ≠ 0 (t-test, since b-1=1) • SPSS Output: (Thalidomide has positive effect, TB None) Coefficientsa -.125 .627 -.200 .843 3.313 .723 .647 4.579 .000 -.313 .723 -.061 -.432 .669 (Constant) DRUG TB Model 1 B Std. Error Unstandardized Coefficients Beta Standardized Coefficients t Sig. Dependent Variable: WTGAINa. Regression with Interaction • Model with interaction (A has a levels, B has b): – Includes a-1 dummy variables for factor A main effects – Includes b-1 dummy variables for factor B main effects – Includes (a-1)(b-1) cross-products of factor A and B dummy variables • Model: µ )()()( 1111111211111 −−−−+−−+−− +++++++++= baabbabbaaaa BABABBAAYE ββββββα LLL As with the ANOVA approach, we can partition the variation to that attributable to Factor A, Factor B, and their interaction Example - Thalidomide for AIDS • Model with interaction: E(Y)=α+β1D+β2T+β3(DT) • Means by Group: – Thalidomide/TB+: α+β1+β2+β3 – Thalidomide/TB-: α+β1 – Placebo/TB+: α+β2 – Placebo/TB-: α • Thalidomide (vs Placebo Effect) Among TB+ Patients: • (α+β1+β2+β3)-(α+β2) = β1+β3 • Thalidomide (vs Placebo Effect) Among TB- Patients: • (α+β1)-α = β1 • Thalidomide effect is same in both TB groups if β3=0 1- Way ANOVA with Dependent Samples (Repeated Measures) • Notation: g Treatments, b Subjects, N=gb • Mean for Treatment i: • Mean for Subject (Block) j: • Overall Mean: iT jS Y ( ) ( ) ( ) )1)(1( :SSError 1 :SSSubject Between 1 :SS TreatmenttBetween 1 :Squares of Sum Total 2 2 2 −−=−−= −=−= −=−= −=−= ∑ ∑ ∑ bgdfSSBLSSTRSSTOSSE bdfYSgSSBL gdfYTbSSTR NdfYYSSTO E BL TR TO ANOVA & F-Test Source df SS MS F Treatments g-1 SSTR MSTR=SSTR/(g-1) F=MSTR/MSE Blocks b-1 SSBL MSBL=SSBL/(b-1) Error (g-1)(b-1) SSE MSE=SSE/[(g-1)(b-1)] Total gb-1 SSTO )( .. .. Exist MeansTrt in sDifference : MeansTreatment in Difference No : )1)(1(,1, 0 obs bggobs obs A FFPP FFRR MSE MSTRFST H H ≥= ≥ = −−−α Post hoc Comparisons (Bonferroni) • Determine number of pairs of Treatment means (g(g-1)/2) • Obtain αC = αE/(g(g-1)/2) and • Obtain • Obtain the “critical quantity”: • Obtain the simultaneous confidence intervals for all pairs of means (with standard interpretations): )1)(1(,2/ −− bgC tα MSE= ^ σ b t 2 ^ σ ( ) b tTT ji 2^σ±−