require(mnormt)
require(fdrtool)
data(erpcz)
data(simerp)
# Paired comparison of ERP curves
tests = erptest(erpcz[,1:251],design=model.matrix(~Subject+Instruction,data=erpcz),
design0=model.matrix(~Subject,data=erpcz))
frames = seq(0,1001,4)
plot(frames,tests$signal,type="l",xlab="Time (ms)",
ylab="Difference ERP curves")
points(frames[tests$significant],rep(0,length(tests$significant)),
pch=16,col="blue")
title("Paired comparison at electrode CZ")
# Independent two-group comparison of ERP curves
tests = erptest(erpcz[,1:251],design=model.matrix(~Instruction,data=erpcz))
frames = seq(0,1001,4)
plot(frames,tests$signal,type="l",xlab="Time (ms)",
ylab="Difference ERP curves")
points(frames[tests$significant],rep(0,length(tests$significant)),
pch=16,col="blue")
title("Independent comparison at electrode CZ")
# Tests for significance of correlations
tests = erptest(simerp[,1:251],design=model.matrix(~y,data=simerp))
plot(frames,sign(tests$signal)*sqrt(tests$r2),type="l",xlab="Time (ms)",
ylab="Correlation",ylim=c(-1,1))
points(frames[tests$significant],rep(-1,length(tests$significant)),
pch=16,col="blue")
title("Simulation")
Run the code above in your browser using DataLab