Analysis of covariance - University of Melbourne

Download Report

Transcript Analysis of covariance - University of Melbourne

Analysis of covariance
Experimental design and data analysis
for biologists (Quinn & Keough, 2002)
Environmental sampling and analysis
Linear models
• All predictors continuous
– regression models
– effects measured as regression slopes
• All predictors categorical
– “ANOVA” models
– effects measured as differences b/w group means
• Continuous and categorical predictors
– covariance models
– effects measured as adjusted differences b/w
group means
Analysis of covariance
• Covariance:
– measure of how much two variables covary, i.e.
vary together
• Analysis of covariance (ANCOVA):
– comparing mean values of response variable
between groups (single or multifactor design)
where response variable covaries with other
measured continuous variables (covariates)
Sex and fruitfly longevity
• Response variable
– longevity of male fruitflies
• Factor A
– “sex” treatment with 5 groups
– 1 virgin female, 8 virgin females,
1 pregnant female etc.
• Covariate
– thorax length
• Hypothesis
– no effect of treatment on longevity of male
fruitflies, adjusting for thorax length
Shrinking in sea urchins
• Response variable
– suture width in sea urchins
• Factor A
– food treatment with 3 groups
– high food, low food, initial sample
• Covariate
– body volume
• Hypothesis
– no effect of food treatment on suture width of sea
urchins, adjusting for body volume
ANCOVA model
yij  constant  a i  bxij  e ij
yij    a i  b ( xij  x )  e ij
ai is effect of factor A (groups or treatments)
b is pooled (across groups) regression slope b/w Y and X
xij is value of covariate for jth observation in ith group
eij is variation in Y not explained by either factor A or
covariate X
Adjusted Y
Adjusted Y values:
yij ( adj)  yij  b( xij  x )
Adjusted Y means:
yi ( adj)  yi  b( xi  x )
Adjusted means
Group 2
y2
y2adj
Group 1
y1adj
y1
x1
x
x2
Assumptions
• Apply to adjusted response variable
• Normality and homogeneity of variances
– boxplots, residual plots, etc.
• Linearity of Y and covariate relationship
– scatterplot
• Covariate not different between groups
– ANOVA on covariate
• Homogeneity of within-group regression
slopes
– test factor by covariate interaction term
Homogeneity of slopes
• Fit model:
– y=+a+x+ax
• Test a by x interaction term
• If not significant
– fit usual ANCOVA model
• If significant
– use Wilcox modification of Johnson-Neyman
procedure
– tedious but informative
Sex and fruitfly longevity
H0: b1 = b2 = b3 = bi (equal within-group regression slopes)
Fit model:
(log longevity)ij = mean + (treatment)i + (thorax length)ij +
(treatment x thorax length)ij + eij
Source
Treatment x thorax length
Residual
df
4
115
MS
F
0.011 1.56
0.007
P
0.189
No evidence to reject H0 of equal within-group slopes
Refit model with pooled regression slope
Sex and fruitfly longevity
2.0
1.9
LLONGEV
1.8
1.7
1.6
GROUP
1.5
1
2
3
4
5
1.4
1.3
1.2
0.6
0.7
0.8
THORAX
0.9
1.0
Sex and fruitfly longevity
H0: 1(adj) = 2(adj) = … = i(adj)
Source
Treatment
Thorax length
Residual
df
4
1
119
MS
0.196
1.017
0.007
F
27.97
145.44
P
<0.001
<0.001
• Reject H0 of equal adjusted mean log longevity between groups
• Also reject H0 of zero pooled regression slope (log longevity against
thorax length)
• ANOVA MSResidual = 0.015 (120df); cf 0.007 above
Sex and fruitfly longevity
Treatment
1 (8 preg females)
2 (no partners)
3 (1 preg female)
4 (1 virg female)
5 (8 virg females)
Adjusted mean
Unadjusted mean
1.808
1.771
1.794
1.717
1.589
1.789
1.789
1.799
1.737
1.564
Further tests
• Planned contrasts and trends on
adjusted means
– partition SS on adjusted means
• Unplanned multiple comparisons on
adjusted means
– use conditional (on covariate) Tukey test
Complexities
• More covariates
– adjust Y for both covariates
– homogeneity of slopes for each covariate
– covariates shouldn’t be correlated (collinearity)
• More factors
– nested or factorial or both
– testing homogeneity of slopes is tricky
• interactions b/w covariate and each factor and b/w
covariate and factor interactions
• X by A, X by B, X by A by B