[R] replicates in repeated ANOVA

Michael Stevens mstevens1107 at yahoo.com
Fri Apr 13 18:14:46 CEST 2007


Hi, 
I have sort of a newbie question. I've seriously put a lot of effort into how to handle simple replicates in a repeated ANOVA design, but haven't had much luck. 
I really liked reading "Notes on the use of R for psychology experiments and questionnaires", by Jonathan Baron and Yuelin Li ( http://www.psych.upenn.edu/~baron/rpsych/rpsych.html ) but still didn't run across an example using simple replicates.
So, I made up the data below semi-borrowing the idea of a reaction time experiment involving noise from Maxwell, S. E. & Delaney, H. D. (1990) Designing Experiments and Analyzing Data: A model comparison perspective. Pacific Grove, CA: Brooks/Cole., which was referenced in the Baron and Li link above.

The experimental concept I'm trying to envision is 2 groups of subjects (Treat and Control), 3 subjects in each.  In one session, all 6 patients from both groups are tested for reaction time by making 3 replicate tests on some hypothetical RT test (I call this the "pre" testing phase below or one could call this baseline ).  In a second session (the "post" phase), the subjects in the "Treat" Group are subjected to noise (or any treatment), while the other 3 "Control" subjects are not, (i.e. the Control subjects are basically tested exactly like they were in the "pre" testing session).

I'm trying to set up the correct model for this experimental design to simply understand whether "noise" (or treatment) has an effect on reaction time.  Can someone tell this newbie the proper name of this experimental design?

By setting up the design this way, I'm hoping one could see if there was a "pre" session to "post" session effect (using the Control group) and then take into account any possible pre->post effect when deciding whether there was a Treatment (noise) effect.  

Unfortunately, whenever, I put the Group factor in the Error term (to take into account subj:Group as a random effect), I get a singular result: (see the data entry section below)

        > rt.aov <- aov(rt ~ Group*prepost + Error(subj/(prepost*Group)), data=rt.df)
        Warning message:
        Error() model is singular in: aov(rt ~ Group * prepost + Error(subj/(prepost * Group)), data = rt.df) 

plus, I'm not sure how to include the replicate factor ("rep") in my Error() term -- should it be something like 
...+Error(subj*rep/(Group*prepost))?            
(this still gives the above error if Group is in the error term, but I'm pretty sure it should be there since all interactions given the individual subject are random effects, aren't they?)
In my hypothetical experiment, I'm assuming the replicates are independent samples of reaction time -- although, admittedly, there could be a trend that should be looked for if one assumes that the subject "gets better" with each replicate.

Suggestions on aov() model welcome!
Thanks,
Michael

-----------------------------------------------------------------
Creating the hypothetical dataset...

> data <- c( 
+ 287,283,261,298,302,280, 
+ 211,272,222,285,253,252, 
+ 266,252,287,266,255,269, 
+ 299,310,285,296,310,301, 
+ 288,265,273,285,252,259, 
+ 295,299,285,288,281,303) 

> rt.df <- data.frame(rt=data, 
+ rep = factor(rep(paste("rep",1:3, sep=""),12)), 
+ prepost = factor(rep(c(rep("pre",3),rep("post",3)),6)), 
+ subj = factor(rep(paste("subj",1:6,sep=""),c(6,6,6,6,6,6))), 
+ Group = factor(c(rep("Treat",18),rep("Control",18)))) 
> rt.df 
rt rep prepost subj Group 
1 287 rep1 pre subj1 Treat 
2 283 rep2 pre subj1 Treat 
3 261 rep3 pre subj1 Treat 
4 298 rep1 post subj1 Treat 
5 302 rep2 post subj1 Treat 
6 280 rep3 post subj1 Treat 
7 211 rep1 pre subj2 Treat 
8 272 rep2 pre subj2 Treat 
9 222 rep3 pre subj2 Treat 
10 285 rep1 post subj2 Treat 
11 253 rep2 post subj2 Treat 
12 252 rep3 post subj2 Treat 
13 266 rep1 pre subj3 Treat 
14 252 rep2 pre subj3 Treat 
15 287 rep3 pre subj3 Treat 
16 266 rep1 post subj3 Treat 
17 255 rep2 post subj3 Treat 
18 269 rep3 post subj3 Treat 
19 299 rep1 pre subj4 Control 
20 310 rep2 pre subj4 Control 
21 285 rep3 pre subj4 Control 
22 296 rep1 post subj4 Control 
23 310 rep2 post subj4 Control 
24 301 rep3 post subj4 Control 
25 288 rep1 pre subj5 Control 
26 265 rep2 pre subj5 Control 
27 273 rep3 pre subj5 Control 
28 285 rep1 post subj5 Control 
29 252 rep2 post subj5 Control 
30 259 rep3 post subj5 Control 
31 295 rep1 pre subj6 Control 
32 299 rep2 pre subj6 Control 
33 285 rep3 pre subj6 Control 
34 288 rep1 post subj6 Control 
35 281 rep2 post subj6 Control 
36 303 rep3 post subj6 Control



More information about the R-help mailing list