Skip to content

Instantly share code, notes, and snippets.

@benwhalley
Created January 15, 2016 12:11
Show Gist options
  • Save benwhalley/4598184bc2dcebac232d to your computer and use it in GitHub Desktop.
Save benwhalley/4598184bc2dcebac232d to your computer and use it in GitHub Desktop.
mysim <- function(){
des <- expand.grid(
congruence=c(1,0),
cuedresp=c("L", "R", "None"),
trial=1:5,
block=1:10,
participant=1:20
)
samp <- des %>% rowwise() %>% mutate(y=rbinom(1,1,.03*congruence))
modelfit <- tidy(lmer(y~congruence +(1|participant), data=samp))
est <- modelfit %>% filter(term=="congruence")
return(est$estimate/est$std.error)
}
sims <- data.frame(simindex=1:10) %>% rowwise() %>% mutate(e=mysim())
summary(sims)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment