R version 4.5.2 (2025-10-31 ucrt) – “[Not] Part in a Rumble” Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type ‘license()’ or ‘licence()’ for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors. Type ‘contributors()’ for more information and ‘citation()’ on how to cite R or R packages in publications.

Type ‘demo()’ for some demos, ‘help()’ for on-line help, or ‘help.start()’ for an HTML browser interface to help. Type ‘q()’ to quit R.

source(“C:/Users/mandreychik/Desktop/FairfieldCollab/FairfieldAnalysis/Clean-and-analyze-editing.R”, echo = TRUE)

#Download data from Gorilla in 2 files, one that amalgamates the task data and one that amalgamates the questionnaire data #questionnaire data wa …. [TRUNCATED]

getwd() [1] “C:/Users/mandreychik/Desktop/FairfieldCollab/FairfieldAnalysis”

library(“ggplot2”)

library(“tidyverse”) ── Attaching core tidyverse packages ──────────────────────────────────────────────────── tidyverse 2.0.0 ── ✔ dplyr 1.2.0 ✔ readr 2.2.0 ✔ forcats 1.0.1 ✔ stringr 1.6.0 ✔ lubridate 1.9.5 ✔ tibble 3.3.1 ✔ purrr 1.2.1 ✔ tidyr 1.3.2 ── Conflicts ────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ── ✖ dplyr::filter() masks stats::filter() ✖ dplyr::lag() masks stats::lag() ℹ Use the conflicted package to force all conflicts to become errors

library(“lme4”) Loading required package: Matrix

Attaching package: ‘Matrix’

The following objects are masked from ‘package:tidyr’:

expand, pack, unpack

library(“lmerTest”)

Attaching package: ‘lmerTest’

The following object is masked from ‘package:lme4’:

lmer

The following object is masked from ‘package:stats’:

step

library(“ez”)

library(“rstatix”)

Attaching package: ‘rstatix’

The following object is masked from ‘package:stats’:

filter

library(“emmeans”) Welcome to emmeans. Caution: You lose important information if you filter this package’s results. See ‘? untidy’

FILTER DATA BASED ON EXCLUSION CRITERIA

the code below is all to just create a list of ID that meet criteria.. w …. [TRUNCATED]

View (quest)

#mark whether met exclusion criteria (will add in the MC attention checks and IAT performance criteria later)

convert to numeric (important! …. [TRUNCATED]

quest\(OtherActiv_time.object.26.Value <- as.numeric(quest\)OtherActiv_time.object.26.Value)

quest\(OtherActiv_time.object.51.Value <- as.numeric(quest\)OtherActiv_time.object.51.Value)

quest\(UseData.object.28.Quantised <- as.numeric(quest\)UseData.object.28.Quantised)

quest\(UseData.object.53.Quantised <- as.numeric(quest\)UseData.object.53.Quantised)

PriorKnowledge

quest <- quest %>% + group_by(Participant.Private.ID) %>% + mutate(PriorKnow = ifelse(any(Task.Name == “Ratings” & Rating.Sc …. [TRUNCATED]

Attention1

##who indicated on the post-experiment survey that they were paying attention less than 75% of the time. quest <- quest %>% + gr …. [TRUNCATED]

#Attention2 ##who indicated on the day 2 post-experiment survey that they were paying attention less than 75% of the time.

quest <- quest %> …. [TRUNCATED]

#UseData1 ##who indicated we should use their data day 1.

quest <- quest %>% + group_by(Participant.Private.ID) %>% + mutate(UseData1 = …. [TRUNCATED]

#UseData2 ##who indicated we should use their data day 2.

quest <- quest %>% + group_by(Participant.Private.ID) %>% + mutate(UseData2 = …. [TRUNCATED]

##Usable data

quest <- quest %>% + mutate( + include = ifelse( + PriorKnow == 1 & + Attention1 == 1 & + Attent …. [TRUNCATED]

include <- subset(quest, include==1)

View(include)

n_distinct(include$Participant.Private.ID) [1] 87

Get unique participant IDs

usable_ids <- unique(include$Participant.Private.ID)

Save to a CSV file

write.csv(usable_ids, “unique_participant_ids.csv”, row.names = FALSE)

##in the as predicted we also said we would exclude those #who failed the attention check questions embedded in the multiple-choice assessment # …. [TRUNCATED]

data = read.csv(‘data_exp_218948-vall_questionnaire-s2in.csv’,h=T)

merged_data <- merge(datLQ, data, by = “Participant.Private.ID”)

View (merged_data)

#####Explicit bias score ##read explicit bias data

explicit = read.csv(‘data_exp_218948-vall_questionnaire-h2tw.csv’,h=T)

View (explicit)

#convert to numbers explicit\(White_therms.object.14.Value <- as.numeric(explicit\)White_therms.object.14.Value)

explicit\(Asians_therm.object.4.Value <- as.numeric(explicit\)Asians_therm.object.4.Value)

explicit\(Women_therm.object.12.Value <- as.numeric(explicit\)Women_therm.object.12.Value)

explicit\(Men_therms.object.13.Value <- as.numeric(explicit\)Men_therms.object.13.Value)

explicit\(Americans_therms.object.15.Value <- as.numeric(explicit\)Americans_therms.object.15.Value)

explicit\(Foreign_therms.object.16.Value <- as.numeric(explicit\)Foreign_therms.object.16.Value)

##Beattie paper looks like they are taking score of “majority group - minority” I did this then averaged across the groups ## Score RACE explic …. [TRUNCATED]

Score GENDER

explicit\(EXP.GENDER <- explicit\)Men_therms.object.13.Value - explicit$Women_therm.object.12.Value

Score IMMIGRANT

explicit\(EXP.IMMIGRANT <- explicit\)Americans_therms.object.15.Value - explicit$Foreign_therms.object.16.Value

##EXPLICIT BIAS (aggregated by averaging RACE, GENDER and IMMIGRANT) explicit$EXP.AGG <- rowMeans(explicit[, c(“EXP.RACE”, “EXP.GENDER”, “EXP.IMMI …” … [TRUNCATED]

#merge into data data2 <- merged_data %>% + left_join( + explicit %>% + select(Participant.Private.ID, EXP.RACE, EXP.GENDER, EXP.IMMIG …. [TRUNCATED]

TIPI scored

##read data (manually remove row 2 with variable descriptions and last empty row)

TIPI = read.csv(’data_exp_2189 …. [TRUNCATED]

View (TIPI)

#already scored in gorilla – so just merged data3 <- data2 %>% + left_join( + TIPI %>% + select(Participant.Private.ID, Score..Extra …. [TRUNCATED]

##########Accent Comprehension ######## ## download tasks as separate files and merge into the rescored version ##THIS DATASET IS long form # …. [TRUNCATED]

View (COMP)

#Sum by participant sum_COMP <- COMP %>% + group_by(Participant.Private.ID) %>% + summarize( + COMPRawTotal = sum(Correct, na.rm = TRUE), …. [TRUNCATED]

view(sum_COMP)

write.csv(sum_COMP, “sum_COMP_HS.csv”, row.names = FALSE)

##merge into dataset data4 <- data3 %>% + left_join( + sum_COMP %>% + select(Participant.Private.ID, COMPRawTotal, COMP_HS_Total), + …. [TRUNCATED]

MC Test Score

MC.Score = read.csv(‘data_exp_218948-vall_task-9747.csv’,h=T)

View (MC.Score)

#select trials that are MC answers (avoid crosswords and SAs) MC.Score2 <- subset(MC.Score, Response.Type == “response” & Screen != “crossword” & …. [TRUNCATED]

View(MC.Score2)

##create 2 sums one for the MC and one for the atttention check quetions sum_MC <- MC.Score2 %>% + group_by(Participant.Private.ID) %>% + sum …. [TRUNCATED]

View(sum_MC)

##merge into dataset data5 <- data4 %>% + left_join( + sum_MC %>% + select(Participant.Private.ID, MC.Score.Agg, MC.attention), + …. [TRUNCATED]

##################SA Test Score ################## # process test score data so can hand code & mrge bck in

SA.Score = read.csv(’data_exp_21 …. [TRUNCATED]

SA <- subset(SA.Score, Response.Type == “response” & (Screen == “SAQuestion1” | Screen == “SAQuestion2” ))

View(SA)

write.csv(SA, “ShortAnswer_Ap16.csv”, row.names = FALSE)

#############Merge in IAT DATA ##################### IAT.Score = read.csv(‘all_iat_d4_scores_fairfield.csv’,h=T)

IAT.Score_sum <- IAT.Score %>% + select(participant, dataset, dscore_d4) %>% + pivot_wider( + names_from = dataset, + values_from = dsco …. [TRUNCATED]

IAT.Score_sum <- IAT.Score_sum %>% + rename(Participant.Private.ID = participant)

##merge into dataset data6 <- data5 %>% + left_join( + IAT.Score_sum %>% + select(Participant.Private.ID, accent_d4_score, asian_d4_sc …. [TRUNCATED]

#Explicit bias score: EXP.AGG, #Agreeableness, Conscientiousness, Openness to experience,: Score..Openness, Score..Conscientiousness, Score..Agre …. [TRUNCATED]

usable_ids <- as.character(filter_data$x) # use the x column

data6\(INCLUDE <- as.integer(as.character(data6\)Participant.Private.ID) %in% usable_ids)

table(data6$INCLUDE)

0 1 115 87

data7 <- subset(data6, INCLUDE==1 & MC.attention==2)

View(data7)

Save to a CSV file

write.csv(data7, “data.csv”, row.names = FALSE)

#####################Regression that enters predictors in two steps ################################## # note to correct error in missing question …. [TRUNCATED]

View (final_dat)

GENDER is multi-category (I dropped the other category but this means that person is dropped from the analysis)

final_dat$Gender <- ifelse(fina …. [TRUNCATED]

##for race - coded as 0 (not white), 1 (white)#

table(final_dat$Race.object.4.White.or.Caucasian)

0 1 6 78

##also the contact 5-pt scales should be treated as ‘continuous’ final_dat\(contact <- as.numeric(final_dat\)contact.object.35.Quantised)

##should center predictors (but doesn’t matter because no interaction terms)– should fix this for real paper # data6\(EXP.AGG_c <- scale(data6\)EXP …. [TRUNCATED]

Step 2: Add additional predictors

model2 <- lm(RS_OverallInstructor.object.16.Quantised ~ + Gender + + Race.obje …. [TRUNCATED]

##make sure N’s are approximately equal for each##

vars <- c( + “RS_OverallInstructor.object.16.Quantised”, + “Gender”, + “Race.object.4. …” … [TRUNCATED]

colSums(!is.na(final_dat[vars])) RS_OverallInstructor.object.16.Quantised Gender 84 84 Race.object.4.White.or.Caucasian EXP.AGG 84 84 Score..Openness Score..Conscientiousness 84 84 Score..Agreeableness contact 84 84 COMP_HS_Total MC.Score.Agg 84 84 accent_d4_score asian_d4_score 84 84

Compare the two models

anova(model1, model2) Analysis of Variance Table

Model 1: RS_OverallInstructor.object.16.Quantised ~ Gender + Race.object.4.White.or.Caucasian Model 2: RS_OverallInstructor.object.16.Quantised ~ Gender + Race.object.4.White.or.Caucasian + EXP.AGG + Score..Openness + Score..Conscientiousness + Score..Agreeableness + contact + COMP_HS_Total + MC.Score.Agg + accent_d4_score + asian_d4_score Res.Df RSS Df Sum of Sq F Pr(>F)
1 81 438.63
2 72 360.71 9 77.921 1.7282 0.09812 . — Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Check model summaries

summary(model1)

Call: lm(formula = RS_OverallInstructor.object.16.Quantised ~ Gender + Race.object.4.White.or.Caucasian, data = final_dat)

Residuals: Min 1Q Median 3Q Max -4.3649 -1.8267 -0.1417 1.6909 3.6351

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.7217 0.9926 5.764 1.43e-07 *** Gender -0.7768 0.5751 -1.351 0.181
Race.object.4.White.or.Caucasian 0.4200 0.9958 0.422 0.674
— Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.327 on 81 degrees of freedom Multiple R-squared: 0.02267, Adjusted R-squared: -0.001458 F-statistic: 0.9396 on 2 and 81 DF, p-value: 0.395

summary(model2)

Call: lm(formula = RS_OverallInstructor.object.16.Quantised ~ Gender + Race.object.4.White.or.Caucasian + EXP.AGG + Score..Openness + Score..Conscientiousness + Score..Agreeableness + contact + COMP_HS_Total + MC.Score.Agg + accent_d4_score + asian_d4_score, data = final_dat)

Residuals: Min 1Q Median 3Q Max -4.2705 -1.6068 -0.2373 1.4007 4.0372

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.975070 2.965741 1.340 0.18435
Gender -0.440347 0.621213 -0.709 0.48071
Race.object.4.White.or.Caucasian 0.379940 1.041603 0.365 0.71636
EXP.AGG 0.004104 0.020806 0.197 0.84421
Score..Openness -0.085384 0.138744 -0.615 0.54023
Score..Conscientiousness 0.103171 0.130063 0.793 0.43025
Score..Agreeableness -0.162686 0.146550 -1.110 0.27065
contact 0.162102 0.288327 0.562 0.57571
COMP_HS_Total 0.044686 0.083021 0.538 0.59207
MC.Score.Agg 0.273692 0.113691 2.407 0.01863 * accent_d4_score -1.756680 0.653534 -2.688 0.00892 ** asian_d4_score 0.261429 0.800384 0.327 0.74490
— Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.238 on 72 degrees of freedom Multiple R-squared: 0.1963, Adjusted R-squared: 0.0735 F-statistic: 1.599 on 11 and 72 DF, p-value: 0.1175

Model predictng overall rating of the lecture

Step 1: Basic predictors

model1 <- lm(RS_OverallLecture.object. …. [TRUNCATED]

Step 2: Add additional predictors

model2 <- lm(RS_OverallLecture.object.17.Quantised ~ + Gender + + Race.object. …. [TRUNCATED]

##make sure N’s are approximately equal for each##

vars <- c( + “RS_OverallInstructor.object.16.Quantised”, + “Gender”, + “Race.object.4. …” … [TRUNCATED]

colSums(!is.na(final_dat[vars])) RS_OverallInstructor.object.16.Quantised Gender 84 84 Race.object.4.White.or.Caucasian EXP.AGG 84 84 Score..Openness Score..Conscientiousness 84 84 Score..Agreeableness contact 84 84 COMP_HS_Total MC.Score.Agg 84 84 accent_d4_score asian_d4_score 84 84

Compare the two models

anova(model1, model2) Analysis of Variance Table

Model 1: RS_OverallLecture.object.17.Quantised ~ Gender + Race.object.4.White.or.Caucasian Model 2: RS_OverallLecture.object.17.Quantised ~ Gender + Race.object.4.White.or.Caucasian + EXP.AGG + Score..Openness + Score..Conscientiousness + Score..Agreeableness + contact + COMP_HS_Total + MC.Score.Agg + accent_d4_score + asian_d4_score Res.Df RSS Df Sum of Sq F Pr(>F)
1 81 302.89
2 72 214.12 9 88.779 3.3171 0.001939 ** — Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Check model summaries

summary(model1)

Call: lm(formula = RS_OverallLecture.object.17.Quantised ~ Gender + Race.object.4.White.or.Caucasian, data = final_dat)

Residuals: Min 1Q Median 3Q Max -4.9272 -0.9272 0.0728 1.0728 3.0728

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.5920 0.8248 7.992 7.79e-12 *** Gender -0.1840 0.4779 -0.385 0.701
Race.object.4.White.or.Caucasian -0.4808 0.8275 -0.581 0.563
— Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.934 on 81 degrees of freedom Multiple R-squared: 0.006865, Adjusted R-squared: -0.01766 F-statistic: 0.28 on 2 and 81 DF, p-value: 0.7565

summary(model2)

Call: lm(formula = RS_OverallLecture.object.17.Quantised ~ Gender + Race.object.4.White.or.Caucasian + EXP.AGG + Score..Openness + Score..Conscientiousness + Score..Agreeableness + contact + COMP_HS_Total + MC.Score.Agg + accent_d4_score + asian_d4_score, data = final_dat)

Residuals: Min 1Q Median 3Q Max -5.4949 -0.7716 0.0798 0.9105 3.0746

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.84915 2.28495 1.247 0.21647
Gender -0.06866 0.47861 -0.143 0.88633
Race.object.4.White.or.Caucasian -0.87030 0.80250 -1.084 0.28177
EXP.AGG -0.02193 0.01603 -1.368 0.17548
Score..Openness 0.10697 0.10689 1.001 0.32032
Score..Conscientiousness 0.01309 0.10021 0.131 0.89639
Score..Agreeableness -0.03631 0.11291 -0.322 0.74871
contact 0.20988 0.22214 0.945 0.34792
COMP_HS_Total 0.03146 0.06396 0.492 0.62435
MC.Score.Agg 0.24739 0.08759 2.824 0.00613 accent_d4_score -1.43165 0.50351 -2.843 0.00581 asian_d4_score 1.59028 0.61665 2.579 0.01196 * — Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.724 on 72 degrees of freedom Multiple R-squared: 0.298, Adjusted R-squared: 0.1907 F-statistic: 2.778 on 11 and 72 DF, p-value: 0.004606

correlation between rting of the lecture and raring of the instruor

cor.test( + final_dat$RS_OverallInstructor.object.16.Quantised, + …. [TRUNCATED]

Pearson's product-moment correlation

data: final_dat\(RS_OverallInstructor.object.16.Quantised and final_dat\)RS_OverallLecture.object.17.Quantised t = 8.147, df = 82, p-value = 3.573e-12 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.5305130 0.7724631 sample estimates: cor 0.6688353

########GRAPH##########

ggplot(final_dat, aes(x = MC.Score.Agg, + y = RS_OverallInstructor.object.16.Quantised)) + + g …. [TRUNCATED] geom_smooth() using formula = ‘y ~ x’

ggplot(final_dat, aes(x = accent_d4_score, + y = RS_OverallInstructor.object.16.Quantised)) + + geom_point(alpha = 0.5) + + …. [TRUNCATED] geom_smooth() using formula = ‘y ~ x’

ggplot(final_dat, aes(x = MC.Score.Agg, + y = RS_OverallLecture.object.17.Quantised)) + + geom_point(alpha = 0.5) + + …. [TRUNCATED] geom_smooth() using formula = ‘y ~ x’

ggplot(final_dat, aes(x = accent_d4_score, + y = RS_OverallLecture.object.17.Quantised)) + + geom_point(alpha = 0.5) + + …. [TRUNCATED] geom_smooth() using formula = ‘y ~ x’

ggplot(final_dat, aes(x = asian_d4_score, + y = RS_OverallLecture.object.17.Quantised)) + + geom_point(alpha = 0.5) + + g …. [TRUNCATED] geom_smooth() using formula = ‘y ~ x’

MODEL FROM AS PREDICTED

#Demographic predictors (1st step): participant gender, participant race #Linguistic & social predictors (2nd step): …. [TRUNCATED]

getwd() [1] “C:/Users/mandreychik/Desktop/FairfieldCollab/FairfieldAnalysis”

library(“ggplot2”)

library(“tidyverse”)

library(“lme4”)

library(“lmerTest”)

library(“ez”)

library(“rstatix”)

library(“emmeans”)

#read in amalgamated questionnaire IAT_WA = read.csv(‘data_exp_218948-vall_tasks.csv’,h=T)

View (IAT_WA)

#Select White vs. Asian IAT

IAT_WA1 <- subset(IAT_WA, Task.Name == “White vs. Asian IAT”)

View(IAT_WA1)

#ID, Order (incong 1st or / congruent 1st); TEST (whether test or practice); block #, trial #, #correct = Correct # latency = Reaction.Time # …. [TRUNCATED]

Whethe practice or tst (practice coded as 1, test as 2)

unique(IAT_WA1$Spreadsheet..metadata) [1] “” “practice_targets_white” “practice_targets_asian” “practice_attributes_pos” [5] “practice_attributes_neg” “congruent1_white” “congruent1_pos” “congruent1_neg”
[9] “congruent1_asian” “switch_white” “switch_asian” “incongruent1_white”
[13] “incongruent1_neg” “incongruent1_asian” “incongruent1_pos”

IAT_WA1 <- IAT_WA1 %>% + mutate( + test = case_when( + Spreadsheet..metadata == “practice_targets_asian” ~ “1”, + Spreadsheet..met …. [TRUNCATED]

##code block### IAT_WA1 <- IAT_WA1 %>% + mutate( + block = case_when( + Display == “trials” & Trial.Number >= 1 & Trial.Number <= 24 …. [TRUNCATED]

libraries

library(tidyverse)

preprocess raw data

IAT_WA2 <- IAT_WA1 %>% + filter( + # 1lter latencies + Reaction.Time <= 10000 + )

prepare Dasis

IAT_WA3 <- IAT_WA2 %>% + group_by( + Participant.Private.ID, Order, test + ) %>% + summarise( + N_x = n(), + M_X …. [TRUNCATED] summarise() has regrouped the output. ℹ Summaries were computed grouped by Participant.Private.ID, Order, and test. ℹ Output is grouped by Participant.Private.ID and Order. ℹ Use summarise(.groups = "drop_last") to silence this message. ℹ Use summarise(.by = c(Participant.Private.ID, Order, test)) for per-operation grouping instead.

prepare calculation

IAT_WA4 <- full_join(IAT_WA2, IAT_WA3) %>% + mutate(D_asis = Reaction.Time) %>% + group_by(Participant.Private.ID, Order …. [TRUNCATED] Joining with by = join_by(Participant.Private.ID, Order, test) summarise() has regrouped the output. ℹ Summaries were computed grouped by Participant.Private.ID, Order, test, block, and SD_X_lat. ℹ Output is grouped by Participant.Private.ID, Order, test, and block. ℹ Use summarise(.groups = "drop_last") to silence this message. ℹ Use summarise(.by = c(Participant.Private.ID, Order, test, block, SD_X_lat)) for per-operation grouping instead.

dd <- IAT_WA4 %>% select(Participant.Private.ID, Order) %>% unique()

for (i in c(3, 4, 6, 7)) { + iat_b <- IAT_WA4 %>% + filter(block == i) %>% + select(-c(test, block)) + names(iat_b) <- c(“Participant.Pr …” … [TRUNCATED]

calculate D-scores

iat_out <- dd %>% + mutate( + # Dasis practise + D_asis_p = case_when( + Order == “CongStart” ~ (M_D_asis_6 - …. [TRUNCATED]

write output to file

write.csv(iat_out, “Iat_Race_scored.csv”, row.names = FALSE)

print(iat_out) # A tibble: 201 × 2 Participant.Private.ID D1 1 13081916 -0.118 2 13081917 0.163 3 13082150 -0.051 4 13082151 0.037 5 13082152 0.056 6 13082153 0.018 7 13082583 0.091 8 13082877 -0.302 9 13082878 -0.062 10 13084094 0.349 # ℹ 191 more rows # ℹ Use print(n = ...) to see more rows

CHECK IAT BASED ON GREENWALD

#B3,B4,B6, B7

#STEP 2: Eliminate trials with latencies ⬎ 10,000 ms; eliminate subjects for whom more than 10 …. [TRUNCATED]

IAT_WA2 <- IAT_WA2 %>% + filter( + # 1lter latencies + Reaction.Time <= 10000 + )

write.csv(IAT_WA2, “IATcheck.csv”, row.names = FALSE)

View(IAT_WA2)

fast_trial_counts <- IAT_WA2 %>% + group_by(Participant.Private.ID) %>% + summarise( + fast_trials = sum(Reaction.Time < 300, na.rm = TRUE) …. [TRUNCATED]

View(IAT_WA2)

fast_trial_counts <- IAT_WA2 %>% + group_by(Participant.Private.ID) %>% + summarise( + fast_trials = sum(Response.Type== “response”, na.rm = …. [TRUNCATED]

1. Compute per-participant trial counts and fast-trial counts

fast_trial_counts <- IAT_WA2 %>% + group_by(Participant.Private.ID) %>% + summ …. [TRUNCATED]

2. Keep only participants with <= 10% fast (<300 ms) trials

participants_to_keep <- fast_trial_counts %>% + filter(prop_fast <= 0.10) %>% # …. [TRUNCATED]

3. Filter your main dataset to only those participants

IAT_WA2_clean <- IAT_WA2 %>% + filter(Participant.Private.ID %in% participants_to_keep)

compute mean of correct latencies for each block

block_means_correct <- IAT_WA2_clean %>% + filter(Correct == 1) %>% + group_by(Particip …. [TRUNCATED]

#Compute one pooled SD for all trials in B3 & B6; another for B4 & B7

participant_pooled_sds <- IAT_WA2_clean %>% + filter( + Response.Ty …. [TRUNCATED]

replace incorrect Rxtimes with mean block

IAT_WA3 <- IAT_WA2_clean %>% + left_join( + block_means_correct, + by = c(“Participant. …” … [TRUNCATED]

##make mean for each block with new values

final_means <- IAT_WA3 %>% + group_by(Participant.Private.ID, block, test) %>% + summarise( + …. [TRUNCATED]

##Compute the differences

calculate D-scores

iat_out <- dd %>% + mutate( + # Dasis practise + D_asis_p = case_when( + Orde …. [TRUNCATED]

write output to file

write.csv(iat_out, “Iat_Race_scored.csv”, row.names = FALSE)

print(iat_out) # A tibble: 201 × 2 Participant.Private.ID D1 1 13081916 -0.118 2 13081917 0.163 3 13082150 -0.051 4 13082151 0.037 5 13082152 0.056 6 13082153 0.018 7 13082583 0.091 8 13082877 -0.302 9 13082878 -0.062 10 13084094 0.349 # ℹ 191 more rows # ℹ Use print(n = ...) to see more rows Warning messages: 1: package ‘tidyverse’ was built under R version 4.5.3 2: package ‘forcats’ was built under R version 4.5.3 3: package ‘lubridate’ was built under R version 4.5.3 4: package ‘ez’ was built under R version 4.5.3 5: package ‘rstatix’ was built under R version 4.5.3 6: package ‘emmeans’ was built under R version 4.5.3