# Figure 1, Interaction plot #getwd() #setwd( ...) rm(list=ls()) library(reshape) library(ggplot2) library(lme4) load("MaskedPriming.rda") # No adjustment for random factors of subjects and words d.rs <- melt(d, id=c( "subjects", "words", "p", "f", "e"), measure=c("srt", "lrt", "rrt") ) nrow(d) nrow(d.rs) nrow(d.rs)/nrow(d) M <- cast(d.rs, p+f+e+variable ~ ., function(x) c(M=mean(x), SD=sd(x), SE=sd(x)/length(x-1)^.5, CI=1.96*(sd(x)/length(x)^.5), length(x), lower=mean(x)-1.96*(sd(x)/length(x)^.5), upper=mean(x)+1.96*(sd(x)/length(x)^.5) ) ) levels(M$variable) <- c("untransformed [s]", "logarithmic [ms]", "reciprocal [-1/s]") M$Priming <- as.factor(M$p) levels(M$Priming) <- c("related", "unrelated") M$Frequency <- as.factor(M$f) levels(M$Frequency) <- c("high", "low") M$Experiment <- as.factor(M$e) levels(M$Experiment) <- c("visually familiar", "visually unfamiliar", "semantically familiar") M$Priming <- factor(M$Priming) M$Priming <- relevel(M$Priming, 2) p <- qplot(Frequency, M, data=M, ylab = "Reaction Time", geom=c("line", "point"), group=Priming, shape=Priming) p <- p + facet_grid(variable ~ Experiment, scales="free_y") + geom_errorbar(aes(max=upper, min=lower, width=0.1)) p + theme_bw()