These files contain the R code I wrote for the second chapter of my PhD thesis.
"Data processing.R" contains the data wrangling of the experimental data. The data were generated in a Gorilla online cognitive task written by Max Rollwage.
"Swing voter cognitive task.R" contains the statistical analyses testing my hypotheses. The analyses include:
- linear models testing whether swing voters integrate disconfirmatory evidence more than other voters
- logistic models testing whether low confirmation bias predicts swing voting behaviour
- likelihood ratio tests testing whether the inclusion of confirmation bias, authoritarianism and conservatism in the model was warranted
- Bayesian t-tests checking whether swing voters have similar levels of confirmation bias as other voters
- the estimation of group-level metacognitive ability through a hierarchical Bayesian framework