4 Analysis of VarianceHypotheses - Whether all group means are equal versus at least two group means are differentThe null and alternative hypotheses areH0:H1: for some, where i represents the mean of population i
5 Analysis of Variance Assumptions - k independent random samples from k normal populations with distributions N(1, 2), …, N(k, 2), respectively.Outcome variable should be continuous.All the populations have the same unknown variance 2 (homogeneous variance).
7 Analysis of VarianceThe main idea for comparing means: what matters is not how far apart the sample means are but how far apart they are relative to the variability of individual observationsANOVA compares the variation due to specific sources within the variation among individuals who should be similar. In particular, ANOVA tests whether several populations have the same mean by comparing how far apart the sample means are with how much variation there is within the sample
8 Analysis of Variance Between Sum of Squares (SSB) Within Sum of Squares (SSW)Total Sum of Squares (SST) SST = SSB + SSW
9 Analysis of Variance Hypotheses: H0: H1: for some Test statistic: ~ MSWMSB~
10 Analysis of Variance Between Mean Squares (MSB) Within Mean Squares (MSW)
12 ANOVA vs. REGRESSION SSR: Between Sum of Squares (SSB) SSE: Within Sum of Squares (SSW)SST: Total Sum of Squares (SST) SST = SSB + SSW
13 ANOVA vs. REGRESSIONBy using a reference coding, we can get similar results to ANOVA with additional information.Additional informationDifference in means between the reference group and other groupsDifference in means between each group and overall mean (when each group has equal N).
14 REFERENCE CODING Each variable takes on only values of 1 and 0. 3 groups: groups 1, 2, and 3 need 2 dummy variablesX2 1 if group 20 OtherwiseX3 1 if group 3
15 REFERENCE CODING For Group 1: X2=0, X3=0: For Group 2: X2=1, X3=0:
17 REFERENCE CODINGIntercept μ is the mean of group 1 (mean of reference group).α2 indicates difference in mean between group 1 (reference group) and group2α3 indicates difference in mean between group 1 (reference group) and group3
26 EFFECT CODINGIntercept μ is the unweighted average of the K group means. In the example here, K=3. If all groups have equal sample size, this is a grand mean.α2 indicates difference between mean of group 2 and unweighted average of K group mean.α3 indicates difference between mean of group 3 and unweighted average of K group mean.
27 list y x x2 x3 x4 x5 y x x2 x3 x4 x5 1. 5 1 -1 -1 -1 -1 .
28 Mean Group1=7.5 intercept=(7.5+5+4.3+5.2+6.2)/5=5.6 regress y x2 x3 x4 x5Source | SS df MS Number of obs =F( 4, 25) =Model | Prob > F =Residual | R-squared =Adj R-squared =Total | Root MSE =y | Coef. Std. Err t P>|t| [95% Conf. Interval]x2 |x3 |x4 |x5 |_cons |Mean Group1= intercept=( )/5=5.6Group2=5 α2= = -0.6 Group3= α3= = -1.3 Group4= α4= = -0.4 Group5= α5= = 0.6
29 Analysis of Covariance (ANACOVA) Why we need to consider control variables?Need to produce accurate estimates of coefficients.interactionconfoundingincrease precision
30 Analysis of Covariance (ANACOVA) A Question to be answered by using ANACOVAIf each control variables have the same distributions between group A and B, what would be the mean response value for group A and B?
31 Analysis of Covariance (ANACOVA) Outcome---continuousCovariatesNominal (study factors of interests)Control variables involve any level of measurements
32 Analysis of Covariance (ANACOVA) Most importantly…..This method is applicable only when there is no interaction effect between the variable of interest with covariates.Y=β0+ β1X+ β2Z+ β3XZ+ΕSee first whether H0: β3=0 is supported.
33 Analysis of Covariance (ANACOVA) Blood pressure data example (X=age, Z=sex)
34 Analysis of Covariance (ANACOVA) sexUnadjusted mean BPAdjusted mean BPMale155.15154.40Female139.86140.89Using the adjusted mean scores removes the influence of age on the comparison of mean blood pressures by considering what the mean BP in the two groups would be if both groups had the same mean age.