Download presentation

Presentation is loading. Please wait.

1
**Clinical Research Training Program 2021**

ANOVA and ANCOVA Fall 2004

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.

3
REGRESSION METHODS Regression ANOVA ANCOVA/Regression

4
Analysis of Variance Hypotheses - Whether all group means are equal versus at least two group means are different The null and alternative hypotheses are H0: 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).

6
• • • • • • • • • • • • • • • • • • • • • • • • •••••••

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

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: ~**

MSW MSB ~

10
**Analysis of Variance Between Mean Squares (MSB)**

Within Mean Squares (MSW)

11
Analysis of Variance Summary Table (ANOVA Table)

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. 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).

14
**REFERENCE CODING Each variable takes on only values of 1 and 0.**

3 groups: groups 1, 2, and 3 need 2 dummy variables X2 1 if group 2 0 Otherwise X3 1 if group 3

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

16
REFERENCE CODING

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

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

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

20
regress y x2 x3 x4 x5 Source | 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=7.5 Group2=5 α2= = -2.5 Group3= α3= = -3.2 Group4= α4= = -2.3 Group5= α5= = -1.3

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

22
**ANOVA vs. REGRESSION anova y x Number of obs = 30 R-squared = 0.3840**

Root MSE = Adj R-squared = Source | Partial SS df MS F Prob > F Model | | x | Residual | Total |

23
**EFFECT CODING 3 groups: groups 1, 2, and 3 need 2 dummy variables**

X2 1 if group 2 0 if group 3 -1 if group 1 X3 1 if group 3 0 if group 2

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

25
EFFECT CODING

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.

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 x5 Source | 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.6 Group2=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. interaction confounding increase precision

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?

31
**Analysis of Covariance (ANACOVA)**

Outcome---continuous Covariates Nominal (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)**

sex Unadjusted mean BP Adjusted mean BP Male 155.15 154.40 Female 139.86 140.89 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.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google