Skip to content

Instantly share code, notes, and snippets.

@mcfrank
Created February 6, 2018 22:53
Show Gist options
  • Select an option

  • Save mcfrank/f4ab33640b431f7cb8a91870e8026550 to your computer and use it in GitHub Desktop.

Select an option

Save mcfrank/f4ab33640b431f7cb8a91870e8026550 to your computer and use it in GitHub Desktop.
making up data for a series of experiments - generic stub code
conditions <- read_csv("condition_means.csv")
generate_data <- function(condition_df, n_subs = 40, n_trials = 3) {
tibble(speaker = condition_df$speaker,
prior = condition_df$prior,
info = condition_df$info,
experiment = condition_df$experiment,
correct = rbinom(1, n_subs * n_trials,
condition_df$mean_correct),
subid = rep(1:n_subs, n_trials))
}
participant_data <- conditions %>%
mutate(index = 1:n()) %>%
split(.$index) %>%
map_df(generate_data)
glmer(correct ~ speaker * prior * info + (1|subid),
data = participant_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment