Added short IDs to data...
Long and short format IDs match in number(28).
Created by Abs Dey 06-04-2025
Participants go through learning, practice, and baseline blocks of Stroop stimuli. Following this, they go through two types of Stroop blocks:
Reward Blocks — A specific ink color is rewarded
No Reward Blocks — No colors/trials are rewarded.
Participants are given 4 cycles of alternating sequences of 1. and 2. above. Reward blocks always start at the beginning of the cycle.
Added short IDs to data...
Long and short format IDs match in number(28).
Note: Removed participant ” 6837a5” due to them pressing any button as fast as possible (<100 ms) during non-reward contexts (see QC trial structure checks).
# RT cutoffs based on prior work
# removing " 6837a5" (note the leading space);
# RTs < 100 during non-rewarded blocks; speeding past those blocks
<- df |>
data filter(Stimulus.RT>200 & Stimulus.RT<3000 & ShortID != " 6837a5")
# reset unique_ids and unique_sids for summaries
<- unique(data$ProlificID)
unique_ids <- unique(data$ShortID) unique_sids
Here we’re inspecting descriptives for only the alternating sequence of reward and no reward blocks. That is, we don’t look at Learning, Practice, or Baseline blocks.
<- data |>
cutoff_rts filter(Stimulus.ACC == 1) |>
group_by(ShortID) |>
summarise(
cutoff_cong = round(unique(CutoffRTcong.Session.)),
cutoff_incong = round(unique(CutoffRTincong.Session.))
|>
) pivot_longer(
cols = c(cutoff_cong, cutoff_incong),
names_to = "cutoff_type",
values_to = "rt_value"
)
<- data |>
p filter(Stimulus.ACC == 1 & !is.na(AlternatingBlocks)) |>
ggplot(aes(x = Stimulus.RT)) +
geom_histogram(aes(y = ..density..), colour = "black", fill = "white", bins = 50) +
geom_density(alpha = .2, fill = "grey40") +
geom_vline(data = cutoff_rts,
aes(xintercept = rt_value, color = cutoff_type),
linetype = "dashed", linewidth = 0.8) +
scale_color_manual(
values = c("cutoff_cong" = "lightgreen", "cutoff_incong" = "lightcoral"),
labels = c("Congruent Cutoff", "Incongruent Cutoff")
+
) facet_wrap(~ ShortID, scales = "free_y", ncol=3) +
scale_x_continuous(
limits = c(150, 3000),
# expand = c(0.02, 0.02),
breaks = seq(300, 2800, by = 500)
+
) labs(
title = "RT by Participant",
x = "RT (ms)",
y = "Density"
+
) theme_minimal() +
theme(
legend.position = "None",
strip.text = element_text(size = 12),
axis.text = element_text(size = 12)
)
ggsave(
filename = "participant_rt_dist.svg",
plot = p,
device = "svg",
width = 18,
height = 18,
dpi = 300,
bg = "white"
)
rm(p) # clearing space
Rewarded Trial | Congruency | Mean RT (ms) | SD | N |
---|---|---|---|---|
No | Congruent | 640 | 100 | 27 |
No | Incongruent | 734 | 118 | 27 |
Yes | Congruent | 468 | 85 | 27 |
Yes | Incongruent | 506 | 100 | 27 |
Rewarded Trial | Congruency | Mean Error | SD | N |
---|---|---|---|---|
No | Congruent | 0.084 | 0.061 | 27 |
No | Incongruent | 0.116 | 0.070 | 27 |
Yes | Congruent | 0.043 | 0.028 | 27 |
Yes | Incongruent | 0.053 | 0.033 | 27 |
Block Type | Color Rewarded (cycle) | Congruency | Mean RT (ms) | SD | N | se |
---|---|---|---|---|---|---|
Reward Block | No | Congruent | 630 | 104 | 27 | 20 |
Reward Block | No | Incongruent | 726 | 119 | 27 | 23 |
Reward Block | Yes | Congruent | 468 | 85 | 27 | 16 |
Reward Block | Yes | Incongruent | 506 | 100 | 27 | 19 |
No Reward Block | No | Congruent | 670 | 103 | 27 | 20 |
No Reward Block | No | Incongruent | 769 | 124 | 27 | 24 |
No Reward Block | Yes | Congruent | 615 | 101 | 27 | 19 |
No Reward Block | Yes | Incongruent | 687 | 142 | 27 | 27 |
Block Type | Word Identity Rewarded (cycle) | Congruency | Mean RT (ms) | SD | N | se |
---|---|---|---|---|---|---|
Reward Block | No | Congruent | 630 | 104 | 27 | 20 |
Reward Block | No | Incongruent | 647 | 103 | 27 | 20 |
Reward Block | Yes | Congruent | 468 | 85 | 27 | 16 |
Reward Block | Yes | Incongruent | 728 | 123 | 27 | 24 |
No Reward Block | No | Congruent | 670 | 103 | 27 | 20 |
No Reward Block | No | Incongruent | 737 | 125 | 27 | 24 |
No Reward Block | Yes | Congruent | 615 | 101 | 27 | 19 |
No Reward Block | Yes | Incongruent | 780 | 150 | 27 | 29 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 524 | 162 | 103 |
No Reward Block | No | Incongruent | 597 | 225 | 98 |
No Reward Block | Yes | Congruent | 497 | 159 | 34 |
No Reward Block | Yes | Incongruent | 664 | 273 | 35 |
Reward Block | No | Congruent | 544 | 143 | 211 |
Reward Block | No | Incongruent | 560 | 242 | 204 |
Reward Block | Yes | Congruent | 391 | 163 | 69 |
Reward Block | Yes | Incongruent | 642 | 198 | 68 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 673 | 174 | 96 |
No Reward Block | No | Incongruent | 774 | 244 | 99 |
No Reward Block | Yes | Congruent | 631 | 125 | 32 |
No Reward Block | Yes | Incongruent | 784 | 328 | 34 |
Reward Block | No | Congruent | 742 | 194 | 195 |
Reward Block | No | Incongruent | 728 | 220 | 198 |
Reward Block | Yes | Congruent | 508 | 116 | 71 |
Reward Block | Yes | Incongruent | 803 | 272 | 64 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 729 | 356 | 103 |
No Reward Block | No | Incongruent | 823 | 395 | 101 |
No Reward Block | Yes | Congruent | 710 | 306 | 36 |
No Reward Block | Yes | Incongruent | 843 | 387 | 32 |
Reward Block | No | Congruent | 693 | 219 | 204 |
Reward Block | No | Incongruent | 675 | 273 | 202 |
Reward Block | Yes | Congruent | 479 | 113 | 69 |
Reward Block | Yes | Incongruent | 818 | 302 | 69 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 728 | 460 | 94 |
No Reward Block | No | Incongruent | 678 | 304 | 97 |
No Reward Block | Yes | Congruent | 590 | 191 | 34 |
No Reward Block | Yes | Incongruent | 667 | 393 | 30 |
Reward Block | No | Congruent | 611 | 254 | 204 |
Reward Block | No | Incongruent | 634 | 275 | 204 |
Reward Block | Yes | Congruent | 501 | 187 | 67 |
Reward Block | Yes | Incongruent | 675 | 298 | 68 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 613 | 244 | 106 |
No Reward Block | No | Incongruent | 799 | 384 | 102 |
No Reward Block | Yes | Congruent | 630 | 291 | 30 |
No Reward Block | Yes | Incongruent | 731 | 277 | 34 |
Reward Block | No | Congruent | 569 | 161 | 209 |
Reward Block | No | Incongruent | 646 | 283 | 202 |
Reward Block | Yes | Congruent | 401 | 90 | 69 |
Reward Block | Yes | Incongruent | 710 | 258 | 70 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 562 | 105 | 103 |
No Reward Block | No | Incongruent | 622 | 203 | 107 |
No Reward Block | Yes | Congruent | 612 | 316 | 36 |
No Reward Block | Yes | Incongruent | 660 | 197 | 34 |
Reward Block | No | Congruent | 547 | 104 | 212 |
Reward Block | No | Incongruent | 574 | 151 | 208 |
Reward Block | Yes | Congruent | 520 | 121 | 70 |
Reward Block | Yes | Incongruent | 606 | 154 | 68 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 629 | 276 | 96 |
No Reward Block | No | Incongruent | 694 | 307 | 93 |
No Reward Block | Yes | Congruent | 592 | 198 | 33 |
No Reward Block | Yes | Incongruent | 687 | 204 | 29 |
Reward Block | No | Congruent | 585 | 207 | 199 |
Reward Block | No | Incongruent | 620 | 260 | 184 |
Reward Block | Yes | Congruent | 452 | 81 | 69 |
Reward Block | Yes | Incongruent | 747 | 256 | 60 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 769 | 393 | 88 |
No Reward Block | No | Incongruent | 789 | 445 | 87 |
No Reward Block | Yes | Congruent | 625 | 261 | 32 |
No Reward Block | Yes | Incongruent | 1105 | 571 | 32 |
Reward Block | No | Congruent | 732 | 349 | 185 |
Reward Block | No | Incongruent | 738 | 363 | 188 |
Reward Block | Yes | Congruent | 504 | 219 | 69 |
Reward Block | Yes | Incongruent | 896 | 406 | 61 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 772 | 278 | 105 |
No Reward Block | No | Incongruent | 829 | 264 | 100 |
No Reward Block | Yes | Congruent | 678 | 191 | 36 |
No Reward Block | Yes | Incongruent | 818 | 299 | 34 |
Reward Block | No | Congruent | 712 | 195 | 208 |
Reward Block | No | Incongruent | 766 | 218 | 204 |
Reward Block | Yes | Congruent | 620 | 318 | 71 |
Reward Block | Yes | Incongruent | 793 | 190 | 67 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 676 | 321 | 92 |
No Reward Block | No | Incongruent | 795 | 420 | 92 |
No Reward Block | Yes | Congruent | 592 | 211 | 36 |
No Reward Block | Yes | Incongruent | 762 | 188 | 32 |
Reward Block | No | Congruent | 666 | 213 | 196 |
Reward Block | No | Incongruent | 676 | 287 | 189 |
Reward Block | Yes | Congruent | 457 | 81 | 68 |
Reward Block | Yes | Incongruent | 788 | 228 | 64 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 688 | 311 | 98 |
No Reward Block | No | Incongruent | 746 | 277 | 92 |
No Reward Block | Yes | Congruent | 558 | 94 | 34 |
No Reward Block | Yes | Incongruent | 763 | 290 | 31 |
Reward Block | No | Congruent | 625 | 159 | 200 |
Reward Block | No | Incongruent | 665 | 235 | 191 |
Reward Block | Yes | Congruent | 478 | 77 | 68 |
Reward Block | Yes | Incongruent | 733 | 169 | 63 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 707 | 270 | 105 |
No Reward Block | No | Incongruent | 684 | 210 | 96 |
No Reward Block | Yes | Congruent | 596 | 150 | 34 |
No Reward Block | Yes | Incongruent | 736 | 235 | 35 |
Reward Block | No | Congruent | 579 | 172 | 196 |
Reward Block | No | Incongruent | 579 | 170 | 198 |
Reward Block | Yes | Congruent | 473 | 87 | 68 |
Reward Block | Yes | Incongruent | 603 | 122 | 62 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 729 | 360 | 75 |
No Reward Block | No | Incongruent | 888 | 434 | 85 |
No Reward Block | Yes | Congruent | 668 | 311 | 30 |
No Reward Block | Yes | Incongruent | 1160 | 489 | 28 |
Reward Block | No | Congruent | 674 | 232 | 199 |
Reward Block | No | Incongruent | 697 | 250 | 184 |
Reward Block | Yes | Congruent | 482 | 117 | 68 |
Reward Block | Yes | Incongruent | 864 | 297 | 60 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 669 | 193 | 94 |
No Reward Block | No | Incongruent | 690 | 206 | 99 |
No Reward Block | Yes | Congruent | 646 | 233 | 36 |
No Reward Block | Yes | Incongruent | 686 | 167 | 32 |
Reward Block | No | Congruent | 631 | 196 | 196 |
Reward Block | No | Incongruent | 645 | 194 | 199 |
Reward Block | Yes | Congruent | 512 | 80 | 72 |
Reward Block | Yes | Incongruent | 686 | 251 | 70 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 707 | 229 | 94 |
No Reward Block | No | Incongruent | 690 | 234 | 96 |
No Reward Block | Yes | Congruent | 625 | 173 | 36 |
No Reward Block | Yes | Incongruent | 710 | 248 | 31 |
Reward Block | No | Congruent | 623 | 152 | 196 |
Reward Block | No | Incongruent | 628 | 225 | 201 |
Reward Block | Yes | Congruent | 430 | 126 | 67 |
Reward Block | Yes | Incongruent | 697 | 203 | 62 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 748 | 171 | 108 |
No Reward Block | No | Incongruent | 836 | 254 | 108 |
No Reward Block | Yes | Congruent | 691 | 134 | 36 |
No Reward Block | Yes | Incongruent | 813 | 235 | 36 |
Reward Block | No | Congruent | 753 | 201 | 212 |
Reward Block | No | Incongruent | 637 | 254 | 213 |
Reward Block | Yes | Congruent | 381 | 113 | 72 |
Reward Block | Yes | Incongruent | 806 | 240 | 72 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 620 | 317 | 73 |
No Reward Block | No | Incongruent | 665 | 438 | 67 |
No Reward Block | Yes | Congruent | 479 | 111 | 27 |
No Reward Block | Yes | Incongruent | 719 | 342 | 27 |
Reward Block | No | Congruent | 616 | 241 | 186 |
Reward Block | No | Incongruent | 645 | 324 | 177 |
Reward Block | Yes | Congruent | 451 | 292 | 68 |
Reward Block | Yes | Incongruent | 735 | 406 | 53 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 532 | 141 | 103 |
No Reward Block | No | Incongruent | 665 | 218 | 103 |
No Reward Block | Yes | Congruent | 511 | 119 | 35 |
No Reward Block | Yes | Incongruent | 666 | 385 | 33 |
Reward Block | No | Congruent | 513 | 104 | 211 |
Reward Block | No | Incongruent | 525 | 156 | 194 |
Reward Block | Yes | Congruent | 392 | 91 | 71 |
Reward Block | Yes | Incongruent | 551 | 81 | 72 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 634 | 212 | 60 |
No Reward Block | No | Incongruent | 685 | 284 | 62 |
No Reward Block | Yes | Congruent | 597 | 136 | 24 |
No Reward Block | Yes | Incongruent | 800 | 371 | 26 |
Reward Block | No | Congruent | 587 | 171 | 166 |
Reward Block | No | Incongruent | 597 | 238 | 173 |
Reward Block | Yes | Congruent | 434 | 135 | 67 |
Reward Block | Yes | Incongruent | 638 | 207 | 59 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 926 | 519 | 97 |
No Reward Block | No | Incongruent | 1166 | 659 | 82 |
No Reward Block | Yes | Congruent | 968 | 635 | 32 |
No Reward Block | Yes | Incongruent | 1020 | 587 | 27 |
Reward Block | No | Congruent | 874 | 466 | 200 |
Reward Block | No | Incongruent | 934 | 520 | 177 |
Reward Block | Yes | Congruent | 713 | 482 | 62 |
Reward Block | Yes | Incongruent | 990 | 431 | 60 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 601 | 111 | 92 |
No Reward Block | No | Incongruent | 700 | 232 | 94 |
No Reward Block | Yes | Congruent | 576 | 140 | 36 |
No Reward Block | Yes | Incongruent | 760 | 315 | 36 |
Reward Block | No | Congruent | 636 | 148 | 188 |
Reward Block | No | Incongruent | 669 | 240 | 190 |
Reward Block | Yes | Congruent | 440 | 103 | 70 |
Reward Block | Yes | Incongruent | 807 | 303 | 64 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 573 | 244 | 94 |
No Reward Block | No | Incongruent | 584 | 144 | 93 |
No Reward Block | Yes | Congruent | 494 | 67 | 34 |
No Reward Block | Yes | Incongruent | 657 | 255 | 30 |
Reward Block | No | Congruent | 495 | 95 | 188 |
Reward Block | No | Incongruent | 566 | 162 | 166 |
Reward Block | Yes | Congruent | 435 | 84 | 68 |
Reward Block | Yes | Incongruent | 602 | 173 | 52 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 516 | 168 | 95 |
No Reward Block | No | Incongruent | 631 | 286 | 91 |
No Reward Block | Yes | Congruent | 528 | 279 | 33 |
No Reward Block | Yes | Incongruent | 722 | 383 | 31 |
Reward Block | No | Congruent | 484 | 114 | 202 |
Reward Block | No | Incongruent | 480 | 169 | 184 |
Reward Block | Yes | Congruent | 348 | 94 | 69 |
Reward Block | Yes | Incongruent | 553 | 194 | 61 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 545 | 265 | 99 |
No Reward Block | No | Incongruent | 564 | 343 | 94 |
No Reward Block | Yes | Congruent | 469 | 110 | 29 |
No Reward Block | Yes | Incongruent | 542 | 180 | 31 |
Reward Block | No | Congruent | 461 | 79 | 197 |
Reward Block | No | Incongruent | 482 | 213 | 194 |
Reward Block | Yes | Congruent | 355 | 80 | 67 |
Reward Block | Yes | Incongruent | 557 | 239 | 57 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 579 | 208 | 98 |
No Reward Block | No | Incongruent | 629 | 229 | 99 |
No Reward Block | Yes | Congruent | 591 | 286 | 32 |
No Reward Block | Yes | Incongruent | 618 | 210 | 34 |
Reward Block | No | Congruent | 528 | 96 | 204 |
Reward Block | No | Incongruent | 516 | 173 | 203 |
Reward Block | Yes | Congruent | 357 | 67 | 68 |
Reward Block | Yes | Incongruent | 570 | 130 | 66 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 864 | 570 | 88 |
No Reward Block | No | Incongruent | 877 | 495 | 94 |
No Reward Block | Yes | Congruent | 733 | 395 | 33 |
No Reward Block | Yes | Incongruent | 1016 | 535 | 28 |
Reward Block | No | Congruent | 846 | 437 | 185 |
Reward Block | No | Incongruent | 820 | 444 | 193 |
Reward Block | Yes | Congruent | 493 | 107 | 68 |
Reward Block | Yes | Incongruent | 944 | 449 | 66 |
BlockType | rewarded_distractor_identity | Congruency | mean_rt | sd_rt | n |
---|---|---|---|---|---|
No Reward Block | No | Congruent | 765 | 268 | 108 |
No Reward Block | No | Incongruent | 798 | 286 | 104 |
No Reward Block | Yes | Congruent | 722 | 280 | 35 |
No Reward Block | Yes | Incongruent | 946 | 404 | 36 |
Reward Block | No | Congruent | 687 | 141 | 213 |
Reward Block | No | Incongruent | 776 | 195 | 200 |
Reward Block | Yes | Congruent | 630 | 182 | 72 |
Reward Block | Yes | Incongruent | 855 | 226 | 70 |
<- data |>
rtc_series_summary filter(!is.na(AlternatingBlocks) & Stimulus.ACC==1 & !is.na(rtc_trialnum)) |>
droplevels() |>
group_by(ShortID) |>
mutate(scaled_rt = scale(Stimulus.RT)) |>
ungroup() |>
group_by(Congruency, rtc_trialnum) |>
summarise(
mean = round(mean(scaled_rt, na.rm = TRUE), 3),
sd = round(sd(scaled_rt, na.rm = TRUE), 3),
n = n(),
.groups = "drop"
|>
) mutate(se = round(sd/sqrt(n), 3))
<- data.frame(
shade_regions xmin = c(1, 36.51, 54.51, 90.51, 108.51, 144.51, 162.51, 198.51),
xmax = c(36.49, 54.49, 90.49, 108.49, 144.49, 162.49, 198.49, 216),
fill = c("paleturquoise1", "grey", "paleturquoise1", "grey",
"paleturquoise1", "grey", "paleturquoise1", "grey")
)
<- ggplot(data = rtc_series_summary,
p aes(x = rtc_trialnum, y = mean,
color = Congruency, group = Congruency)) +
geom_rect(data = shade_regions,
aes(xmin = xmin, xmax = xmax,
ymin = -Inf, ymax = Inf,
fill = fill),
inherit.aes = FALSE,
alpha = 0.2) +
scale_fill_identity() + # Use the fill colors as specified
geom_point(size = 3) +
geom_line(size = 1) +
geom_errorbar(aes(ymin = mean - se,
ymax = mean + se),
width = 0.2) +
scale_color_manual(values = c("Congruent" = "lightgreen",
"Incongruent" = "lightcoral")) +
scale_x_continuous(breaks = seq(0, max(rtc_series_summary$rtc_trialnum),
by = 5), expand = c(0,0)) +
labs(x = "Rewarded Trial Number",
y = "Reaction Time (scaled)",
title = "RT Series for only Rewarded Colors by Congruency") +
ylim(c(-2.5, 2.5)) +
theme_classic() +
theme(axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),
axis.text.x = element_text(size = 14),
axis.text.y = element_text(size = 14),
legend.title = element_text(size = 18),
legend.text = element_text(size = 16),
legend.background = element_blank(),
legend.key = element_blank(),
legend.position = c(.96, .15),
plot.title = element_text(size = 28))
ggsave(
filename = "rewarded_color_series.svg",
plot = p,
device = "svg",
width = 30,
height = 6,
dpi = 300,
bg = "white"
)
rm(p) # clearing space
<- data |>
rtc_stroop_summary filter(!is.na(AlternatingBlocks) & Stimulus.ACC==1 & !is.na(rtc_trialnum)) |>
droplevels() |>
group_by(ShortID) |>
mutate(scaled_rt = scale(Stimulus.RT)) |>
ungroup() |>
group_by(Congruency, rtc_trialnum)|>
summarise(
mean_rt = round(mean(scaled_rt, na.rm=TRUE), 3),
.groups = "drop"
|>
) pivot_wider(
id_cols = rtc_trialnum,
names_from = Congruency,
values_from = mean_rt
|>
) mutate(stroop_scaled = Incongruent - Congruent)
<- ggplot(data = rtc_stroop_summary, aes(x = rtc_trialnum, y = stroop_scaled)) +
p geom_rect(data = shade_regions,
aes(xmin = xmin, xmax = xmax,
ymin = -Inf, ymax = Inf,
fill = fill),
inherit.aes = FALSE,
alpha = 0.2) +
scale_fill_identity() + # Use the fill colors as specified
geom_point(size = 3) +
geom_line(size = 1) +
geom_hline(yintercept=0, linetype=2, size=1, color = "tomato3") +
scale_x_continuous(breaks = seq(0, max(rtc_stroop_summary$rtc_trialnum),
by = 5), expand = c(0,0)) +
labs(x = "Rewarded Trial Number",
y = "Stroop (scaled)",
title = "Stroop Series for only Rewarded Colors") +
ylim(c(-2.5, 2.5)) +
theme_classic() +
theme(axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),
axis.text.x = element_text(size = 14),
axis.text.y = element_text(size = 14),
plot.title = element_text(size = 28))
ggsave(
filename = "stroop_series.svg",
plot = p,
device = "svg",
width = 30,
height = 6,
dpi = 300,
bg = "white"
)
rm(p)
<- data |>
rtc_series_err_summary filter(!is.na(AlternatingBlocks) & !is.na(rtc_trialnum)) |>
mutate(error=1-Stimulus.ACC) |>
group_by(Congruency, rtc_trialnum) |>
summarise(
mean = round(mean(error, na.rm = TRUE), 3),
sd = round(sd(error, na.rm = TRUE), 3),
n = n(),
.groups = "drop"
|>
) mutate(se = round(sd/sqrt(n), 3))
<- data.frame(
shade_regions xmin = c(1, 36.51, 54.51, 90.51, 108.51, 144.51, 162.51, 198.51),
xmax = c(36.49, 54.49, 90.49, 108.49, 144.49, 162.49, 198.49, 216),
fill = c("paleturquoise1", "grey", "paleturquoise1", "grey",
"paleturquoise1", "grey", "paleturquoise1", "grey")
)
<- ggplot(data = rtc_series_err_summary,
p aes(x = rtc_trialnum, y = mean,
color = Congruency, group = Congruency)) +
geom_rect(data = shade_regions,
aes(xmin = xmin, xmax = xmax,
ymin = -Inf, ymax = Inf,
fill = fill),
inherit.aes = FALSE,
alpha = 0.2) +
scale_fill_identity() + # Use the fill colors as specified
geom_point(size = 3) +
geom_line(size = 1) +
geom_errorbar(aes(ymin = mean - se,
ymax = mean + se),
width = 0.2) +
scale_color_manual(values = c("Congruent" = "lightgreen",
"Incongruent" = "lightcoral")) +
scale_x_continuous(breaks = seq(0, max(rtc_series_err_summary$rtc_trialnum),
by = 5), expand = c(0,0)) +
labs(x = "Rewarded Trial Number",
y = "Error Rate",
title = "Error Rate Series for only Rewarded Colors by Congruency") +
ylim(c(-0.03, 0.63)) +
theme_classic() +
theme(axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),
axis.text.x = element_text(size = 14),
axis.text.y = element_text(size = 14),
legend.title = element_text(size = 18),
legend.text = element_text(size = 16),
legend.background = element_blank(),
legend.key = element_blank(),
legend.position = c(.96, .90),
plot.title = element_text(size = 28))
ggsave(
filename = "rewarded_color_error_series.svg",
plot = p,
device = "svg",
width = 30,
height = 6,
dpi = 300,
bg = "white"
)
rm(p) # clearing space
<- data |>
rtc_err_stroop_summary filter(!is.na(AlternatingBlocks) & !is.na(rtc_trialnum)) |>
mutate(error=1-Stimulus.ACC) |>
group_by(Congruency, rtc_trialnum)|>
summarise(
mean_err = round(mean(error, na.rm=TRUE), 3),
.groups = "drop"
|>
) pivot_wider(
id_cols = rtc_trialnum,
names_from = Congruency,
values_from = mean_err
|>
) mutate(err_stroop = Incongruent - Congruent)
<- ggplot(data = rtc_err_stroop_summary, aes(x = rtc_trialnum, y = err_stroop)) +
p geom_rect(data = shade_regions,
aes(xmin = xmin, xmax = xmax,
ymin = -Inf, ymax = Inf,
fill = fill),
inherit.aes = FALSE,
alpha = 0.2) +
scale_fill_identity() + # Use the fill colors as specified
geom_point(size = 3) +
geom_line(size = 1) +
geom_hline(yintercept=0, linetype=2, size=1, color = "tomato3") +
scale_x_continuous(breaks = seq(0, max(rtc_err_stroop_summary$rtc_trialnum),
by = 5), expand = c(0,0)) +
labs(x = "Rewarded Trial Number",
y = "Error Stroop",
title = "Error Rate Stroop Series for only Rewarded Colors") +
ylim(c(-.5, .5)) +
theme_classic() +
theme(axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),
axis.text.x = element_text(size = 14),
axis.text.y = element_text(size = 14),
plot.title = element_text(size = 28))
ggsave(
filename = "err_stroop_series.svg",
plot = p,
device = "svg",
width = 30,
height = 6,
dpi = 300,
bg = "white"
)rm(p)