Mike Lawrence <mike <at> thatmike.com> writes: Thanks for the excellent reproducible sample set!
> I'm most interested in the interaction between color and type, but I > know that there is likely an effect of word. Yet since word is not > completely crossed with type, simply adding it to an aov() won't work. > A colleague recommended I look into lme() but so far I can't figure > out the proper call. Without word, it would be summary(lme(rt~type*color, data=a,random=~1|id)) With the interaction, the extreme would be summary(lme(rt~type*color*word, data=a,random=~1|id)) or, less extreme summary(lme(rt~type*color+color:word, data=a,random=~1|id)) but all these fail because of the rather degenerate structure of you data set. While lmer in package lme4 allows for a wider set of solutions, I currently do not see how it could help, but I might be wrong with p=0.5. word happy joy sad grumpy type color positive white 93 90 0 0 red 90 88 0 0 green 88 87 0 0 negative white 0 0 88 95 red 0 0 91 85 green 0 0 88 88 > > Another issue is whether to collapse across repetition before running > the stats, particularly since errors will leave unequal numbers of > observations per cell if it's left in. That's one of the points where you have little to bother with the lme approach. Collapsing would give equal weights to unequal numbers of repeat, and might of minor importance when not too extreme, though. Dieter set.seed(1) a=rbind( cbind( type='positive' ,expand.grid( id=1:10 ,color=c('white','red','green') ,word=c('happy','joy') ,repetition = 1:10 ) ) ,cbind( type='negative' ,expand.grid( id=1:10 ,color=c('white','red','green') ,word=c('sad','grumpy') ,repetition = 1:10 ) ) ) #add some fake rt data a$rt=rnorm(length(a[,1])) #And because people make errors sometimes: a$error = rbinom(length(a[,1]),1,.1) #remove error trials because they're not psychologically interesting: a=a[a$error==0,] library(nlme) ftable(a[,c(1,3,4)]) summary(lme(rt~type*color, data=a,random=~1|id)) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.