car::Anova Way to have a covariate that does not interact with the within-subject factors

StackOverflow https://stackoverflow.com/questions/11567446

  •  22-06-2021
  •  | 
  •  

Question

I would like to run an ANCOVA using car::Anova but cannot find out if there is a way to add a covariate only as a main effect (i.e., should not interact with anything).

As far as I understand ANCOVA, covariates are just another main effect added to the model (i.e., one more effect), thereby controlling for the overall additive influence of this covariate. Followingly, the covariate(s) do not interact with the other factors. However, I cannot add a variable to Anova that does not interact with the within-subject factors (i.e., my final model does not seem to ba an ANCOVA).

Let me illustrate my problem with an example from ?Anova. The OBrienKaiser data set has 2 between (treatment and gender) and 2 within (phase and hour) factors. Now lets assume we also recorded the age of the participants and would like to add it as a covariate to the any analysis.

require(car)
set.seed(1)

n.OBrienKaiser <- within(OBrienKaiser, age <- sample(18:35, size = 16, replace = TRUE))

# the next part is taken from ?Anova
# I only modified the mod.ok <- ... call by adding + age
phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)), levels=c("pretest", "posttest", "followup"))
hour <- ordered(rep(1:5, 3))
idata <- data.frame(phase, hour)

mod.ok <- lm(cbind(pre.1, pre.2, pre.3, pre.4, pre.5, post.1, post.2, post.3, post.4, post.5, 
          fup.1, fup.2, fup.3, fup.4, fup.5) ~  treatment*gender + age, data=n.OBrienKaiser)
(av.ok <- Anova(mod.ok, idata=idata, idesign=~phase*hour, type = 3)) 

As the results show, the results contain interaction with the covariate age, namely of the within-subject (or repeated-measures) factors phase, hour and their interaction phase:hour:

Type III Repeated Measures MANOVA Tests: Pillai test statistic
                            Df test stat approx F num Df den Df Pr(>F)  
(Intercept)                  1     0.129     1.33      1      9  0.278  
treatment                    2     0.443     3.58      2      9  0.072 .
gender                       1     0.305     3.95      1      9  0.078 .
age                          1     0.054     0.52      1      9  0.490  
treatment:gender             2     0.222     1.28      2      9  0.323  
phase                        1     0.418     2.87      2      8  0.115  
treatment:phase              2     0.871     3.47      4     18  0.029 *
gender:phase                 1     0.084     0.37      2      8  0.703  
age:phase                    1     0.393     2.59      2      8  0.136  
treatment:gender:phase       2     0.545     1.69      4     18  0.197  
hour                         1     0.565     1.95      4      6  0.222  
treatment:hour               2     0.580     0.72      8     14  0.676  
gender:hour                  1     0.310     0.68      4      6  0.633  
age:hour                     1     0.508     1.55      4      6  0.301  
treatment:gender:hour        2     0.707     0.96      8     14  0.504  
phase:hour                   1     0.975     9.56      8      2  0.098 .
treatment:phase:hour         2     1.145     0.50     16      6  0.873  
gender:phase:hour            1     0.693     0.56      8      2  0.770  
age:phase:hour               1     0.974     9.40      8      2  0.100 .
treatment:gender:phase:hour  2     1.314     0.72     16      6  0.723  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

My question is: Can one run a ANCOVA with car::Anova and if so is there a way to specify this ANCOVA without any interaction of age?


Update (July 22, 2012): I asked this question on R-help, but so far no responses. If there are news, I will post it here.

Was it helpful?

Solution

I asked this question on R-help which started a helpful discussion with John Fox (later joined by Peter Dalgaard). Unfortunately it got split up into two threads: one, two.

The punchline is: "The within-subjects contrasts are constructed by Anova() to be orthogonal in the row-basis of the design, so you should be able to safely ignore the effects in which (for some reason that escapes me) you are uninterested." (John Fox)

So the answer to the question is: No one can't, but it doesn't matter because these interactions do not alter the other effects as they are orthogonal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top