Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Clinical Research Training Program 2021 ANOVA and ANCOVA Fall 2004 www.edc.gsph.pitt.edu/faculty/dodge/clres2021.html.

Similar presentations


Presentation on theme: "1 Clinical Research Training Program 2021 ANOVA and ANCOVA Fall 2004 www.edc.gsph.pitt.edu/faculty/dodge/clres2021.html."— Presentation transcript:

1

2 1 Clinical Research Training Program 2021 ANOVA and ANCOVA Fall 2004

3 2 ANOVA vs. REGRESSION ANOVA can be regarded as a special type of linear regressions. By using dummy coding, we can get coefficients which indicate difference in means in various groups.

4 3 REGRESSION METHODS Regression ANOVA ANCOVA/ Regression

5 4 Analysis of Variance  The null and alternative hypotheses are H 0 : H 1 : for some, where  i represents the mean of population i  Hypotheses - Whether all group means are equal versus at least two group means are different

6 5  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). Analysis of Variance

7 6

8 7 Analysis of Variance  The 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 observations  ANOVA 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

9 8 Analysis of Variance  Between Sum of Squares (SSB)  Within Sum of Squares (SSW)  Total Sum of Squares (SST)  SST = SSB + SSW

10 9 Analysis of Variance  Hypotheses:H 0 : H 1 : for some  Test statistic: ~ MSW MSB

11 10 Analysis of Variance  Between Mean Squares (MSB)  Within Mean Squares (MSW)

12 11 Analysis of Variance Summary Table (ANOVA Table)

13 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

14 13 ANOVA vs. REGRESSION By using a reference coding, we can get similar results to ANOVA with additional information. Additional information Difference in means between the reference group and other groups Difference in means between each group and overall mean (when each group has equal N).

15 14 REFERENCE CODING Each variable takes on only values of 1 and 0. 3 groups: groups 1, 2, and 3  need 2 dummy variables X 2 1 if group 2 0 Otherwise X 3 1 if group 3 0 Otherwise

16 15 REFERENCE CODING For Group 1: X2=0, X3=0: For Group 2: X2=1, X3=0: For Group 3: X2=0, X3=1:

17 16 REFERENCE CODING

18 17 REFERENCE CODING Intercept μ 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

19 18. list y x x2 x3 x4 x5 y x x2 x3 x4 x

20 19 sort x. by x:summarize y _______________________________________________________________________________ -> x = 1 Variable | Obs Mean Std. Dev. Min Max y | _______________________________________________________________________________ -> x = 2 Variable | Obs Mean Std. Dev. Min Max y | _______________________________________________________________________________ -> x = 3 Variable | Obs Mean Std. Dev. Min Max y | _______________________________________________________________________________ -> x = 4 Variable | Obs Mean Std. Dev. Min Max y | _______________________________________________________________________________ -> x = 5 Variable | Obs Mean Std. Dev. Min Max y |

21 20 regress y x2 x3 x4 x5 Source | SS df MS Number of obs = F( 4, 25) = 3.90 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=7.5 Group2=5 α2=5- 7.5= -2.5 Group3=4.3 α3= = -3.2 Group4=5.2 α4= = -2.3 Group5=6.2 α5= = -1.3

22 21 ANOVA vs. REGRESSION  SSR: Between Sum of Squares (SSB)  SSE: Within Sum of Squares (SSW)  SST: Total Sum of Squares (SST)  SST = SSB + SSW

23 22 ANOVA vs. REGRESSION anova y x Number of obs = 30 R-squared = Root MSE = Adj R-squared = Source | Partial SS df MS F Prob > F Model | | x | | Residual | Total |

24 23 EFFECT CODING 3 groups: groups 1, 2, and 3  need 2 dummy variables X 2 1 if group 2 0 if group 3 -1 if group 1 X 3 1 if group 3 0 if group 2 -1 if group 1

25 24 EFFECT CODING For Group 1: X2=-1, X3=-1: For Group 2: X2=1, X3=0: For Group 3: X2=0, X3=1:

26 25 EFFECT CODING

27 26 EFFECT CODING Intercept μ 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.

28 27 list y x x2 x3 x4 x5 y x x2 x3 x4 x

29 28 regress y x2 x3 x4 x5 Source | SS df MS Number of obs = F( 4, 25) = 3.90 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=7.5 intercept=( )/5=5.6 Group2=5 α2=5- 5.6= -0.6 Group3=4.3 α3= = -1.3 Group4=5.2 α4= = -0.4 Group5=6.2 α5= = 0.6

30 29 Analysis of Covariance (ANACOVA) Why we need to consider control variables? Need to produce accurate estimates of coefficients. interaction confounding increase precision

31 30 Analysis of Covariance (ANACOVA) A Question to be answered by using ANACOVA If each control variables have the same distributions between group A and B, what would be the mean response value for group A and B?

32 31 Analysis of Covariance (ANACOVA) Outcome---continuous Covariates –Nominal (study factors of interests) –Control variables involve any level of measurements

33 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 + β 1 X+ β 2 Z+ β 3 XZ+Ε See first whether H 0 : β 3 =0 is supported.

34 33 Analysis of Covariance (ANACOVA) Blood pressure data example (X=age, Z=sex)

35 34 Analysis of Covariance (ANACOVA) sexUnadjusted mean BP Adjusted mean BP Male Female Using 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.


Download ppt "1 Clinical Research Training Program 2021 ANOVA and ANCOVA Fall 2004 www.edc.gsph.pitt.edu/faculty/dodge/clres2021.html."

Similar presentations


Ads by Google