require(mnormt)
require(fdrtool)
data(erpcz)
data(simerp)
# Paired t-tests for the comparison of ERP curves between two groups
tests = erpfatest(erpcz[,1:251],design=model.matrix(~Subject+Instruction,data=erpcz),
design0=model.matrix(~Subject,data=erpcz),nbf=3,s0=c(1:50,226:251),min.err=1e-01)
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")
# Tests for significance of correlations
tests = erpfatest(simerp[,1:251],design=model.matrix(~y,data=simerp),
nbf=5,min.err=1e-01,maxiter=10)
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