# LMM for combined Bodner & Masson (1997) and Kinoshita (2006) data # getwd() # setwd( ... ) library(MASS) library(lattice) library(ggplot2) library(lme4) rm(list=ls()) load("MaskedPriming.rda") # Helmert contrast for experiments cmat <- matrix(c(-1, 1, 0, -1, -1, 2), 3, 2, dimnames=list(c("BM1", "BM2", "SK"), c(".BM1-2", ".BM-SK"))) # Baseline model contrasts(d$e) <- cmat print(m0 <- lmer(rrt ~ 1 + p*f*e + (1 | subjects) + (1 | words), data=d), cor=FALSE) # Checking significance of correlations # ... rrt (replace "rrt" with "lrt" for log(RT) or "srt" for untransformed RT) print(m1 <- lmer(rrt ~ 1 + p*f*e + (1 | subjects) + (0 + p | subjects) + (0 + f | subjects) + (1 | words), data=d), cor=FALSE) print(m1.p <- lmer(rrt ~ 1 + p*f*e + (p | subjects) + (0+f | subjects) + (1 | words), data=d), cor=FALSE) print(m1.f <- lmer(rrt ~ 1 + p*f*e + (f | subjects) + (0+p | subjects) + (1 | words), data=d), cor=FALSE) print(m1.pf <- lmer(rrt ~ 1 + p*f*e + (1 | subjects) + (0+p+f | subjects) + (1 | words), data=d), cor=FALSE) print(m2 <- lmer(rrt ~ 1 + p*f*e + (p + f | subjects) + (1 | words), data=d), cor=FALSE) anova(m1, m1.p, m2) # correlation of freq and priming with intercept improve fit; corr between freq and priming does not (.359) anova(m1, m1.f, m2) anova(m1, m1.pf, m2) # For table only m0 vs. m2 anova(m0, m2)