4

Here is an ANOVA model with one between-subject factor (condition; 4 levels) and one within-subject factor (trial_seq; 20 levels).

amod = aov(decision_quality ~ condition*trial_seq +
       Error(user_id/trial_seq), data = d.task1)
summary(amod)

I want to do a pairwise analysis for both the between-subject factor and the within-subject factor. I found that it is not straightforward to use a function like TukeyHSD() for a within-subject factor. I researched this problem and found some suggestions in another thread.

However, my lack of statistical background prevented me from fully understanding vignettes coming with the multcomp package. Anyway, I tried some random statements like:

summary(glht(amod, linfct = mcp(trial_seq = "Tukey")))

However, it generates the following error:

Error in model.matrix.aovlist(model) : 
  ‘glht’ does not support objects of class ‘aovlist’
Error in summary(glht(amod, linfct = mcp(trial_seq = "Tukey"))) : 
  error in evaluating the argument 'object' in selecting a method for     
function 'summary': Error in factor_contrasts(model) : 
  no ‘model.matrix’ method for ‘model’ found!
  • What did I do wrong?
jiggysoo
  • 175
  • 1
  • 4
  • I found another suggestion at http://yatani.jp/HCIstats/PostHoc saying simply use pairwise.t.test(decision_quality, trial_seq, p.adj="bonferroni", paired=T) for the post-hoc test of the within-subject factor. I am not sure if this is a correct. – jiggysoo Jul 05 '11 at 11:56
  • According to http://www.uky.edu/ComputingCenter/SSTARS/www/documentation/MultipleComparisons_3.htm#b23, SAS provide the SIMULATE option for general mixed and repeated measures models. Is there anything equivalent in R? – jiggysoo Jul 05 '11 at 16:21

1 Answers1

1

As the error message exemplifies, glht does not accept objects of type aovlist. In other words, there is no way of running contrasts with an ANOVA specified via aov.

To achieve what you want you would need to use another way of specifiying the repeated measures ANOVA, namels via lme in the lmer package (using a compound symmteric correlation structure). For a description see my answer to this thread. Because glht can handle lme objects.

If you have problems implementing this procedure please be specific on where your problems are.

Henrik
  • 13,314
  • 9
  • 63
  • 123