#----- # #This is an example script how the residuals were extrated from RT variable. #IMPORTANT: To run the lmer analysis, data need to be arranged into "long" format. Dataset.csv file provided with the manuscript is as recorded, in a "wide" format. # #----- #Installing and loading neccesary package for runnig Linear mixed effects model analysis, here we used lmerTest package. install.packages(lmerTest) library(lmerTest) # Setting up working directory. folder0 <- "C:/MMA Reaction times/Dataset" # Set directory relevant to where you stored the dataset file. setwd(folder0) reaction_times <- read.csv("Dataset_restructured.CSV",header = T,sep = ";") #loading dataset CSV file into a dataframe. # Setting variables as factors and scaling further covariates. reaction_times$Condition <- as.factor(reaction_times$Condition) class(reaction_times$Condition) reaction_times$Trial <- scale(reaction_times$Trial) reaction_times$FI <- scale(reaction_times$FI) reaction_times$RT <- scale(reaction_times$RT) #Running the analysis and having the result reported. modelRT <- lmer(RT ~ Condition + Trial + Condition:Trial + FI + (1|ID), data = reaction_times) summary(modelRT) #Extracting residuals and adding them as a new variable into new dataframe. residualsRT <- (abs(residuals(modelRT))) reaction_times$residualsRT <- residualsRT RT_residuals <- reaction_times View(residualsRT) #Viewing the residuals. write.csv(RT_residuals, file = "RT_residuals.csv") #Saving new dataframe with the residuals column as a new dataset CSV file for further analysis.