N <- 200 # nr of observations per condition
M <- 50 # nr of participants
p <- seq(0.1, 0.9, 0.4) # mixture proportions
means <- c(0.3, 0.3) # means of base distributions are equal, yielding a warning if check=TRUE
sigma <- 5 # scale of base distributions
bw <- 0.01
# kernel bandwidth of the density estimation. Too small values yield a warning if check=TRUE
### generate data
rt <- NULL
for (i in 1:length(p)) {
rt <- c(rt, ifelse(sample(0:1, N * M, replace = TRUE, prob = c(p[i], 1 - p[i])),
rnorm(N * M, means[1], sigma), rnorm(N * M, means[2], sigma)))
}
rt <- rt + rep(rnorm(M, sd = 0.1), times = N) # normally distributed pp random effect
dat <- data.frame(rt = rt, cond = rep(1:length(p), each = N * M), pp = rep(1:M,
each = N))
### compute crossing points
res <- tapply(1:nrow(dat), dat$pp, function(X) {
fpGet(dat[X, ], 1000, bw = bw)
})
### test fixed point
fpAnova(res, stat = "both", check=TRUE) # this provides both warnings
Run the code above in your browser using DataLab