[R] ANCOVA post-hoc test

Evagelopoulos Thanasis tevagelo at marine.aegean.gr
Sun Feb 12 13:39:32 CET 2012


Could you please help me on the following ANCOVA issue?

This is a part of my dataset:

sampling dist         h
1        wi  200 0.8687212
2        wi  200 0.8812909
3        wi  200 0.8267464
4        wi    0 0.8554508
5        wi    0 0.9506721
6        wi    0 0.8112781
7        wi  400 0.8687212
8        wi  400 0.8414646
9        wi  400 0.7601675
10       wi  900 0.6577048
11       wi  900 0.6098403
12       wi  900 0.5574382
13       sp  200 0.9149264
14       sp  200 0.9149264
15       sp  200 0.9248187
16       sp    0 0.9974016
17       sp    0 0.9997114
18       sp    0 0.8812909
...

h is the dependent variable, distance the covariate and sampling the factor.

the slopes for h~distance linear regressions are significantly different from 0 for all samplings

In order to compare the regression slopes for each sampling, i did an ANCOVA with the ancova() function of the HH package:

>mod<-ancova(h~sampling*dist,data)

There was a significant interaction term:

Analysis of Variance Table

Response: h
              Df  Sum Sq Mean Sq F value    Pr(>F)
sampling       3 0.22822 0.07607 13.7476 2.624e-06 ***
dist           1 0.51291 0.51291 92.6908 5.703e-12 ***
sampling:dist  3 0.05112 0.01704  3.0792   0.03822 *
Residuals     40 0.22134 0.00553

Because there exist significantly different regression slopes, I did a post hoc test with glht() to find out between which samplings:

>summary(glht(mod, linfct=mcp(sampling="Tukey")))

The results seem to say that there are no significantly different slopes for any of the pair-wise comparisons of factor levels:

  Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: aov(formula = h ~ sampling * dist, data = data)

Linear Hypotheses:
             Estimate Std. Error z value Pr(>|z|)
sp - au == 0  0.06696    0.04562   1.468    0.457
su - au == 0 -0.02238    0.04562  -0.491    0.961
wi - au == 0  0.01203    0.04562   0.264    0.994
su - sp == 0 -0.08934    0.04562  -1.958    0.204
wi - sp == 0 -0.05493    0.04562  -1.204    0.624
wi - su == 0  0.03441    0.04562   0.754    0.875
(Adjusted p values reported -- single-step method)

Warning message:
In mcp2matrix(model, linfct = linfct) :
  covariate interactions found -- default contrast might be inappropriate



My questions are:

- Did I make a mistake somewhere? (I probably did!)
- Could I do pairwise ANCOVAs and thus have just two factor levels (=two regression slopes) to compare each time?
What does the warning message "covariate interactions found -- default contrast might be inappropriate" mean?

Thank you!
Athanasios Evagelopoulos


More information about the R-help mailing list