Anova Example 2, Mixed


library('BayesFactor')

############################################
#BLOCK 1

#load data
dat=read.table(url('http://pcl.missouri.edu/jeff/sites/pcl.missouri.edu.jeff/files/aov2.dat'),head=T)

#dont forget to treat subjects categorically rather than continuously

dat$sub=as.factor(dat$sub)

#conventional
means=tapply(dat$rt,list(dat$age,dat$pos,dat$col),mean)

#Anova
summary(aov(rt~age*pos*col+Error(sub/(pos*col)),data=dat))

#######################################
#Block 2

bf = anovaBF(rt~age*pos*col+sub, data = dat,whichModels="withmain",whichRandom="sub")

#Lot of Models
bf=sort(bf,decreasing=T)
plot(bf)

#winner is age + pos + age*pos +sub
#what do I want to compare to?

#how strong is that interaction?
bf[1]/bf[2]

#let's keep the interaction for now, doesnt really matter
#what if I take out age?
bf[1]/bf[12]
#what if I take out pos?
bf[1]/bf[15]

#what if I add col, best model with color
bf[1]/bf[3]

#######################################

AttachmentSize
aov2.dat5.58 KB

Research Methods 3020