Created
February 6, 2018 22:53
-
-
Save mcfrank/f4ab33640b431f7cb8a91870e8026550 to your computer and use it in GitHub Desktop.
making up data for a series of experiments - generic stub code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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