Skip to main content
2 of 2
edited tags; edited tags
amoeba
  • 107.2k
  • 36
  • 321
  • 346

Post-tests for mixed-model ANOVA in R? (Without installing packages?)

(Question originally posted on StackOverflow but users advised it was more appropriate to ask here:)

I’m just starting out with R so I apologise if this is a silly question, however I have Googled it extensively and can’t seem to find an answer. I am attempting to analyse data with structure:

'data.frame':   60 obs. of  4 variables:
 $ response: num  8.2 8.2 9.4 11 9.9 9.5 9.8 11.1 10.9 9.7 ...
 $ subject : Factor w/ 10 levels "1","2","3","4",..: 1 1 1 1 1 1 2 2 2 2 ...
 $ dose    : Factor w/ 3 levels "A","B","C": 1 1 2 2 3 3 1 1 2 2 ...
 $ time    : Factor w/ 2 levels "dawn","dusk": 1 2 1 2 1 2 1 2 1 2 ...

I.e. there are 10 subjects, for each subject there are two recordings at each of three doses: one at dusk and one at dawn.

So I performed a mixed model ANOVA as follows:

aov1<- aov(response~dose*time + Error(subject/(dose*time)))

Which worked fine and generated the result:

Error: subject
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  9   4417   490.8               

Error: subject:dose
          Df Sum Sq Mean Sq F value Pr(>F)  
dose       2  25.95  12.975   3.681 0.0457 *
Residuals 18  63.45   3.525                 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: subject:time
          Df Sum Sq Mean Sq F value   Pr(>F)    
time       1  78.66   78.66   27.14 0.000557 ***
Residuals  9  26.09    2.90                     
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: subject:dose:time
          Df Sum Sq Mean Sq F value Pr(>F)
dose:time  2   4.09   2.046   0.578  0.571
Residuals 18  63.70   3.539      

This I took to mean that there was a significant (p<0.05) effect of time and dose but not a significant interaction. Time has only two levels so that’s self-explanatory, but dose has three levels, and I’d now like to do a post-test to check which ones are significantly different from each other. However I can’t work out how to do this. “TukeyHSD(aov1)” and “summary.lm(aov1)” (to use contrasts) don’t seem to work in the same way that they did with one-way ANOVAs that I have some prior experience with.

Since I am working in a high-security area and I'm not sure if I'd be able to download and install packages without specific authorisation (I won't know until I have a meeting in a fortnight or so), I was wondering if there is any way to do some form of post-test to assess the differences between different doses WITHOUT downloading and installing any further packages?

Thanks in advance for any advice!

Mel
  • 213
  • 3
  • 8