ctrl/cmd + shift + K in RStudio) to produce a HTML file.tidyverse (or ggplot2, dplyr, purrr, tibble)brmsdevtools (for installing faintr)rstanfaintr (install with devtools)Load the required packages and set a seed for the random number generator.
library(tidyverse)
library(rstan)
# set cores to use to the total number of cores (minimally 4)
options(mc.cores = max(parallel::detectCores(), 4))
# save a compiled version of the Stan model file
rstan_options(auto_write = TRUE)
library(brms)
# install faintr with devtools::install_github('michael-franke/bayes_mixed_regression_tutorial/faintr', build_vignettes = TRUE))
library(faintr)
set.seed(123)
Use read_csv() and glimpse()
# your code here
Do this with the select() command.
# your code here
Use mutate(): * expected should be a factor (also rename this to condition) * correctness should be a factor * angle should be a factor * trial_type should be a factor
# your code here
Check that everything is there and of the correct type.
# your code here
Use filter().
# your code here
Show condition (same/different) on the x-axis and RT on the y-axis. Show the different angles in different colors (fill). (use ggplot() and geom_boxplot)
# your code here
Use filter() to filter only response times that are in a reasonable range.
# your code here
Use group_by() %>% summarise().
# your code here
Use brm to model the response times from angle, condition and angle*condition.
# your code here
Use faintr::compare_groups()
"Responses to ‘same’ trials are faster than responses to ‘different’ trials.
# your code here
"Responses to ‘50 degree’ trials are faster than responses to ‘150 degree’ trials.
# your code here
“Angle matters more than same/different for response times”. (In other words, when the angle is lower but the objects are ‘different’, people are still faster than when the angle is higher but the objects are the ‘same’.)
# your code here
Include random by-item intercepts (+ (1|item)).
# your code here
# your code here
Write a conclusion about the results.
End of sheet.