This online book is a reprint of:
Bernabeu, P. (2022). Language and sensorimotor simulation in conceptual processing: Multilevel analysis and statistical power. Lancaster University. https://doi.org/10.17635/lancaster/thesis/1795
Materials: https://osf.io/vyb8k
Setup code
General parameters are set in this section.
Code
options(knitr.duplicate.label = 'allow')
# General knitr options
::opts_chunk$set(cache = FALSE, message = FALSE, warning = FALSE,
knitrerror = FALSE, echo = TRUE, collapse = TRUE,
fig.align = 'center', dev = 'CairoPDF',
knitr.graphics.auto_pdf = TRUE, dpi = 72,
out.width = '100%')
library(rmdfiltr) # Adjust format of citations to match APA
library(knitr) # Document rendering
library(kableExtra) # Tables
library(dplyr) # Data wrangling
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:kableExtra':
##
## group_rows
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
Code
library(reshape2) # Data wrangling
library(formattable) # Format numbers
library(kableExtra) # Table formatting (e.g., `pack_rows()`)
library(stringr) # Text processing
library(car) # Analysis
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
##
## recode
Code
library(lmerTest) # Analysis
## Loading required package: lme4
## Loading required package: Matrix
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
Code
library(simr) # Analysis
##
## Attaching package: 'simr'
## The following object is masked from 'package:lme4':
##
## getData
## The following object is masked from 'package:stringr':
##
## fixed
Code
library(ggplot2) # Plots
library(ggridges) # Plots
library(ggtext) # Plots
library(GGally) # Correlation plots
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
Code
library(sjPlot) # Model plots
## Install package "strengejacke" from GitHub (`devtools::install_github("strengejacke/strengejacke")`) to load all sj-packages at once!
Code
library(RColorBrewer) # Colours in plots
library(patchwork) # Combination of plots
##
## Attaching package: 'patchwork'
## The following object is masked from 'package:formattable':
##
## area
Code
library(Cairo) # Allows use of special characters such as dashes in plots
library(magick) # Image rendering
## Linking to ImageMagick 6.9.12.3
## Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
## Disabled features: fontconfig, x11
Code
library(tikzDevice) # Image rendering
Code
# Read in all custom functions
setwd('R_functions')
sapply(list.files(), source, echo = FALSE)
setwd('../')
# Load main data sets and models. These objects are loaded directly, rather than
# being run on the go, to keep the knitting of the manuscript reasonably fast.
# Crucially, however, all the objects can be reproduced from the appropriate R
# scripts in the current project.
# Study 2.2.1: Semantic priming
# Code for data set below in 'semanticpriming/data' folder
= read.csv('semanticpriming/data/final_dataset/semanticpriming.csv')
semanticpriming
# Code for models below in 'semanticpriming/frequentist_analysis' folder
= # Primary model object
semanticpriming_lmerTest readRDS('semanticpriming/frequentist_analysis/results/semanticpriming_lmerTest.rds')
= # Model with Kenward-Roger p values
KR_summary_semanticpriming_lmerTest readRDS('semanticpriming/frequentist_analysis/results/KR_summary_semanticpriming_lmerTest.rds')
= # Confidence intervals
confint_semanticpriming_lmerTest readRDS('semanticpriming/frequentist_analysis/results/confint_semanticpriming_lmerTest.rds')
# Subset of the semantic priming study that included vision-based similarity.
# Code for data set below in 'semanticpriming/data' folder
=
semanticpriming_with_visualsimilarity read.csv('semanticpriming/data/subset_with_visualsimilarity/semanticpriming_with_visualsimilarity.csv')
# Code for models below in 'semanticpriming/semanticpriming_with_visualsimilarity' folder
= # Primary model object
semanticpriming_with_visualsimilarity_lmerTest readRDS('semanticpriming/analysis_with_visualsimilarity/results/semanticpriming_with_visualsimilarity_lmerTest.rds')
= # Model with Kenward-Roger p values
KR_summary_semanticpriming_with_visualsimilarity_lmerTest readRDS('semanticpriming/analysis_with_visualsimilarity/results/KR_summary_semanticpriming_with_visualsimilarity_lmerTest.rds')
= # Confidence intervals
confint_semanticpriming_with_visualsimilarity_lmerTest readRDS('semanticpriming/analysis_with_visualsimilarity/results/confint_semanticpriming_with_visualsimilarity_lmerTest.rds')
# Code for models below in 'semanticpriming/bayesian_analysis' folder
=
semanticpriming_summary_informativepriors_exgaussian readRDS('semanticpriming/bayesian_analysis/results/semanticpriming_summary_informativepriors_exgaussian.rds')
=
semanticpriming_summary_weaklyinformativepriors_exgaussian readRDS('semanticpriming/bayesian_analysis/results/semanticpriming_summary_weaklyinformativepriors_exgaussian.rds')
=
semanticpriming_summary_diffusepriors_exgaussian readRDS('semanticpriming/bayesian_analysis/results/semanticpriming_summary_diffusepriors_exgaussian.rds')
# Study 2.2: Semantic decision
# Code for data set below in 'semanticdecision/data' folder
= read.csv('semanticdecision/data/final_dataset/semanticdecision.csv')
semanticdecision
# Code for models below in 'semanticdecision/frequentist_analysis' folder
= # Primary model object
semanticdecision_lmerTest readRDS('semanticdecision/frequentist_analysis/results/semanticdecision_lmerTest.rds')
= # Model with Kenward-Roger p values
KR_summary_semanticdecision_lmerTest readRDS('semanticdecision/frequentist_analysis/results/KR_summary_semanticdecision_lmerTest.rds')
= # Confidence intervals
confint_semanticdecision_lmerTest readRDS('semanticdecision/frequentist_analysis/results/confint_semanticdecision_lmerTest.rds')
# Code for models below in 'semanticdecision/bayesian_analysis' folder
=
semanticdecision_summary_informativepriors_exgaussian readRDS('semanticdecision/bayesian_analysis/results/semanticdecision_summary_informativepriors_exgaussian.rds')
=
semanticdecision_summary_weaklyinformativepriors_exgaussian readRDS('semanticdecision/bayesian_analysis/results/semanticdecision_summary_weaklyinformativepriors_exgaussian.rds')
=
semanticdecision_summary_diffusepriors_exgaussian readRDS('semanticdecision/bayesian_analysis/results/semanticdecision_summary_diffusepriors_exgaussian.rds')
# Study 2.3: Lexical decision
# Code for data set below in 'lexicaldecision/data' folder
= read.csv('lexicaldecision/data/final_dataset/lexicaldecision.csv')
lexicaldecision
# Code for models below in 'lexicaldecision/frequentist_analysis' folder
= # Primary model object
lexicaldecision_lmerTest readRDS('lexicaldecision/frequentist_analysis/results/lexicaldecision_lmerTest.rds')
= # Model with Kenward-Roger p values
KR_summary_lexicaldecision_lmerTest readRDS('lexicaldecision/frequentist_analysis/results/KR_summary_lexicaldecision_lmerTest.rds')
= # Confidence intervals
confint_lexicaldecision_lmerTest readRDS('lexicaldecision/frequentist_analysis/results/confint_lexicaldecision_lmerTest.rds')
# Code for models below in 'lexicaldecision/bayesian_analysis' folder
=
lexicaldecision_summary_informativepriors_exgaussian readRDS('lexicaldecision/bayesian_analysis/results/lexicaldecision_summary_informativepriors_exgaussian.rds')
=
lexicaldecision_summary_weaklyinformativepriors_exgaussian readRDS('lexicaldecision/bayesian_analysis/results/lexicaldecision_summary_weaklyinformativepriors_exgaussian.rds')
=
lexicaldecision_summary_diffusepriors_exgaussian readRDS('lexicaldecision/bayesian_analysis/results/lexicaldecision_summary_diffusepriors_exgaussian.rds')
Pablo Bernabeu, 2022. Licence: CC BY 4.0.
Thesis: https://doi.org/10.17635/lancaster/thesis/1795.
Online book created using the R package bookdown.
Thesis: https://doi.org/10.17635/lancaster/thesis/1795.
Online book created using the R package bookdown.