The changing object could appear in four possible locations. Subjects were instructed to press ‘F’ if there was a changing object and to press ‘J’ if there was no changing object. Trials are labeled 1 for correct responses (‘F’ on change trials and ‘J’ on no-change trials) or 0 for incorrect responses (‘J’ on change trials and ‘F’ on no-change trials).
Accuracy on catch trials
Sum the number of good catch trials (1) to get the total number of accurate catch trials per subject. There were 36 total catch trials. ** Catch trials consisted of one object always changing to a letter. **
tbl_good_catch_acc_all_main_acc_counts <- tbl_all_change_acc %>%
filter(validity=='catch')
tbl_good_catch_acc_all_main_acc_counts <- tbl_good_catch_acc_all_main_acc_counts %>%
group_by(workerId,acc) %>%
dplyr::summarize(counts = n()) %>%
spread(acc,counts)
tbl_good_catch_acc_all_main_acc_counts[is.na(tbl_good_catch_acc_all_main_acc_counts)] <- 0
tbl_good_catch_acc_all_main_acc_counts$total = rowSums(tbl_good_catch_acc_all_main_acc_counts[,c(-1)], na.rm = TRUE)
colnames(tbl_good_catch_acc_all_main_acc_counts) <- c("workerId", "inacc_catch", "acc_catch", "total_catch")
kable(tbl_good_catch_acc_all_main_acc_counts)
| A10AVWALIHR4UQ |
0 |
36 |
36 |
| A12FTSX85NQ8N9 |
21 |
15 |
36 |
| A1916FQFP74ED6 |
10 |
26 |
36 |
| A198MSVO1VTAT5 |
20 |
16 |
36 |
| A1BNYBF79IQ89T |
33 |
3 |
36 |
| A1CNTYNF0MIBK8 |
14 |
22 |
36 |
| A1EBGIM9CZTQLX |
0 |
36 |
36 |
| A1F3XD5WEK7H7E |
18 |
18 |
36 |
| A1G4MDRJ3Y36DA |
16 |
20 |
36 |
| A1P2RQ166VS5BT |
8 |
28 |
36 |
| A25N8DM670K4MA |
17 |
19 |
36 |
| A26LOVXF4QZZCO |
0 |
36 |
36 |
| A28AXX4NCWPH1F |
2 |
34 |
36 |
| A28RKM9Q1FIZEK |
22 |
14 |
36 |
| A2F2DDH12YU4AK |
9 |
27 |
36 |
| A2MUCL20GTQJA0 |
0 |
36 |
36 |
| A2NO3OTBZYY43Z |
1 |
35 |
36 |
| A2V27A9GZA1NR2 |
1 |
35 |
36 |
| A386U6K4J1ANQI |
21 |
15 |
36 |
| A3B9QNYDDXGL9I |
3 |
33 |
36 |
| A3C9SDM1TKNS65 |
21 |
15 |
36 |
| A3CP03KUNUMEWF |
5 |
31 |
36 |
| A3I448WWTX2A2D |
15 |
21 |
36 |
| A3IBAGEKMDEGSI |
21 |
15 |
36 |
| A3JMLA0FWLP0WA |
19 |
17 |
36 |
| A3KCAT0C3NWVDX |
32 |
4 |
36 |
| A3PLWSCPFLCEGI |
0 |
36 |
36 |
| A3QT2DS5XYKYHU |
7 |
29 |
36 |
| A4I69DE7BI20I |
24 |
12 |
36 |
| A8C3WNWRBWUXO |
0 |
36 |
36 |
| AA8PZKO9XGCKO |
1 |
35 |
36 |
| ABYFMKPTF0SHG |
10 |
26 |
36 |
| AMPMTF5IAAMK8 |
24 |
12 |
36 |
| ANV9R86DM2YG5 |
14 |
22 |
36 |
| AQMJMYR9MANOG |
20 |
16 |
36 |
| ASL9UNVWVM9AW |
16 |
20 |
36 |
Divide the number of accurate catch trials by the number of total catch trials for each participant. The resulting value will be the subjects catch trial rate.
tbl_all_catch_acc_rate <- (tbl_good_catch_acc_all_main_acc_counts$acc_catch / tbl_good_catch_acc_all_main_acc_counts$total_catch)
tbl_all_catch_acc_rate <- cbind.data.frame(tbl_good_catch_acc_all_main_acc_counts[,1], tbl_all_catch_acc_rate)
colnames(tbl_all_catch_acc_rate) <- c("workerId", "catch_rate")
kable(tbl_all_catch_acc_rate)
| A10AVWALIHR4UQ |
1.0000000 |
| A12FTSX85NQ8N9 |
0.4166667 |
| A1916FQFP74ED6 |
0.7222222 |
| A198MSVO1VTAT5 |
0.4444444 |
| A1BNYBF79IQ89T |
0.0833333 |
| A1CNTYNF0MIBK8 |
0.6111111 |
| A1EBGIM9CZTQLX |
1.0000000 |
| A1F3XD5WEK7H7E |
0.5000000 |
| A1G4MDRJ3Y36DA |
0.5555556 |
| A1P2RQ166VS5BT |
0.7777778 |
| A25N8DM670K4MA |
0.5277778 |
| A26LOVXF4QZZCO |
1.0000000 |
| A28AXX4NCWPH1F |
0.9444444 |
| A28RKM9Q1FIZEK |
0.3888889 |
| A2F2DDH12YU4AK |
0.7500000 |
| A2MUCL20GTQJA0 |
1.0000000 |
| A2NO3OTBZYY43Z |
0.9722222 |
| A2V27A9GZA1NR2 |
0.9722222 |
| A386U6K4J1ANQI |
0.4166667 |
| A3B9QNYDDXGL9I |
0.9166667 |
| A3C9SDM1TKNS65 |
0.4166667 |
| A3CP03KUNUMEWF |
0.8611111 |
| A3I448WWTX2A2D |
0.5833333 |
| A3IBAGEKMDEGSI |
0.4166667 |
| A3JMLA0FWLP0WA |
0.4722222 |
| A3KCAT0C3NWVDX |
0.1111111 |
| A3PLWSCPFLCEGI |
1.0000000 |
| A3QT2DS5XYKYHU |
0.8055556 |
| A4I69DE7BI20I |
0.3333333 |
| A8C3WNWRBWUXO |
1.0000000 |
| AA8PZKO9XGCKO |
0.9722222 |
| ABYFMKPTF0SHG |
0.7222222 |
| AMPMTF5IAAMK8 |
0.3333333 |
| ANV9R86DM2YG5 |
0.6111111 |
| AQMJMYR9MANOG |
0.4444444 |
| ASL9UNVWVM9AW |
0.5555556 |
Plot the group’s overall accuracy on the catch trials.
tbl_all_catch_acc_rate %>%
ggbarplot(y = "catch_rate", ylab = "Accuracy", fill = "#f7a800", color = "#f7a800", add = "mean_se", ylim = c(0, 1), xlab = "Group", width = 0.5, label = TRUE, lab.nb.digits = 2, lab.vjust = -2, title = "Group Catch Performance")

Let’s also take a look at each individual subject’s catch trial performance rate.
tbl_all_catch_acc_rate %>%
ggbarplot(x = "workerId", y = "catch_rate", ylab = "Accuracy", fill = "#f7a800", color = "#f7a800", ylim = c(0, 1), title = "Individual Catch Performance", sort.val = c("asc"), font.xtickslab = 8) + rotate_x_text()+ geom_hline(yintercept = 0.5, linetype = 2)

Accuracy on change trials
For the rest of the analyses, focus on the participants with good catch rate performance. Select the subjects with good catch trial rates from the original tbl_all.
#tbl_good_catch_acc_all_main_acc <- tbl_all[(tbl_all$workerId %in% tbl_good_catch_acc_rate$workerId),]
tbl_good_catch_acc_all_main_acc <- tbl_all[(tbl_all$workerId %in% tbl_all_catch_acc_rate$workerId),]
Verify subject count.
nrow(tbl_good_catch_acc_all_main_acc %>% distinct(workerId,.keep_all = FALSE))
## [1] 36
Here, is a table containing the number of trials for each individual after excluding main trials based on accuracy. Again, there were 120 change main trials that were 60% valid (72 trials) and 40% invalid (24 trials for each type). This chunk will also bin the counts in a separate table.
tbl_good_catch_acc_all_main_acc_counts <- tbl_good_catch_acc_all_main_acc %>%
group_by(workerId,validity) %>%
filter(change_or_no_change == "change" & (validity=='valid' | validity=='invalid_same' | validity=='invalid_different') & acc == 1) %>%
dplyr::summarize(counts = n()) %>%
spread(validity,counts)
tbl_good_catch_acc_all_main_acc_counts$sum = rowSums(tbl_good_catch_acc_all_main_acc_counts[,c(-1)], na.rm = TRUE)
tbl_good_catch_acc_all_main_acc_counts[is.na(tbl_good_catch_acc_all_main_acc_counts)] <- 0
kable(tbl_good_catch_acc_all_main_acc_counts)
| A10AVWALIHR4UQ |
0 |
2 |
53 |
55 |
| A12FTSX85NQ8N9 |
1 |
0 |
67 |
68 |
| A1916FQFP74ED6 |
13 |
10 |
41 |
64 |
| A198MSVO1VTAT5 |
7 |
3 |
69 |
79 |
| A1BNYBF79IQ89T |
13 |
13 |
26 |
52 |
| A1CNTYNF0MIBK8 |
10 |
12 |
33 |
55 |
| A1EBGIM9CZTQLX |
14 |
13 |
42 |
69 |
| A1F3XD5WEK7H7E |
3 |
1 |
57 |
61 |
| A1G4MDRJ3Y36DA |
9 |
8 |
37 |
54 |
| A1P2RQ166VS5BT |
1 |
2 |
54 |
57 |
| A25N8DM670K4MA |
13 |
17 |
36 |
66 |
| A26LOVXF4QZZCO |
8 |
13 |
56 |
77 |
| A28AXX4NCWPH1F |
1 |
0 |
71 |
72 |
| A28RKM9Q1FIZEK |
11 |
10 |
26 |
47 |
| A2F2DDH12YU4AK |
11 |
8 |
26 |
45 |
| A2MUCL20GTQJA0 |
15 |
12 |
56 |
83 |
| A2NO3OTBZYY43Z |
14 |
15 |
52 |
81 |
| A2V27A9GZA1NR2 |
21 |
15 |
49 |
85 |
| A386U6K4J1ANQI |
14 |
11 |
47 |
72 |
| A3B9QNYDDXGL9I |
16 |
15 |
43 |
74 |
| A3C9SDM1TKNS65 |
10 |
14 |
37 |
61 |
| A3CP03KUNUMEWF |
17 |
15 |
45 |
77 |
| A3I448WWTX2A2D |
14 |
14 |
39 |
67 |
| A3IBAGEKMDEGSI |
9 |
11 |
33 |
53 |
| A3JMLA0FWLP0WA |
7 |
12 |
39 |
58 |
| A3KCAT0C3NWVDX |
4 |
6 |
12 |
22 |
| A3PLWSCPFLCEGI |
21 |
24 |
70 |
115 |
| A3QT2DS5XYKYHU |
7 |
7 |
16 |
30 |
| A4I69DE7BI20I |
8 |
8 |
21 |
37 |
| A8C3WNWRBWUXO |
8 |
6 |
63 |
77 |
| AA8PZKO9XGCKO |
22 |
20 |
66 |
108 |
| ABYFMKPTF0SHG |
10 |
13 |
37 |
60 |
| AMPMTF5IAAMK8 |
4 |
8 |
61 |
73 |
| ANV9R86DM2YG5 |
10 |
15 |
27 |
52 |
| AQMJMYR9MANOG |
14 |
12 |
34 |
60 |
| ASL9UNVWVM9AW |
9 |
11 |
40 |
60 |
tbl_good_catch_acc_all_main_acc_counts_bin <- tbl_good_catch_acc_all_main_acc %>%
filter(bin != 0) %>%
group_by(workerId,validity,bin, .drop=FALSE) %>%
filter(change_or_no_change == "change" & (validity=='valid' | validity=='invalid_same' | validity=='invalid_different') & acc == 1, .preserve = TRUE) %>%
dplyr::summarize(counts = n()) %>%
spread(validity,counts)
tbl_good_catch_acc_all_main_acc_counts_bin[is.na(tbl_good_catch_acc_all_main_acc_counts_bin)] <- 0
tbl_good_catch_acc_all_main_acc_counts_bin$sum = rowSums(tbl_good_catch_acc_all_main_acc_counts_bin[,c(-1:-2)], na.rm = TRUE)
And let’s check the number of subjects we are now working with.
nrow(tbl_good_catch_acc_all_main_acc_counts %>% distinct(workerId,.keep_all = FALSE))
## [1] 36
Get the original number of trials for the relevant subjects.
tbl_good_catch_acc_all_main_acc_counts_original <- tbl_all_change_counts_no_catch[(tbl_all_change_counts_no_catch$workerId %in% tbl_good_catch_acc_all_main_acc_counts$workerId),]
kable(tbl_good_catch_acc_all_main_acc_counts_original)
| A10AVWALIHR4UQ |
24 |
24 |
72 |
120 |
| A12FTSX85NQ8N9 |
24 |
24 |
72 |
120 |
| A1916FQFP74ED6 |
24 |
24 |
72 |
120 |
| A198MSVO1VTAT5 |
24 |
24 |
72 |
120 |
| A1BNYBF79IQ89T |
24 |
24 |
72 |
120 |
| A1CNTYNF0MIBK8 |
24 |
24 |
72 |
120 |
| A1EBGIM9CZTQLX |
24 |
24 |
72 |
120 |
| A1F3XD5WEK7H7E |
24 |
24 |
72 |
120 |
| A1G4MDRJ3Y36DA |
24 |
24 |
72 |
120 |
| A1P2RQ166VS5BT |
24 |
24 |
72 |
120 |
| A25N8DM670K4MA |
24 |
24 |
71 |
119 |
| A26LOVXF4QZZCO |
24 |
24 |
72 |
120 |
| A28AXX4NCWPH1F |
24 |
24 |
72 |
120 |
| A28RKM9Q1FIZEK |
24 |
24 |
72 |
120 |
| A2F2DDH12YU4AK |
24 |
24 |
72 |
120 |
| A2MUCL20GTQJA0 |
24 |
24 |
72 |
120 |
| A2NO3OTBZYY43Z |
24 |
24 |
72 |
120 |
| A2V27A9GZA1NR2 |
24 |
24 |
72 |
120 |
| A386U6K4J1ANQI |
24 |
24 |
72 |
120 |
| A3B9QNYDDXGL9I |
24 |
24 |
72 |
120 |
| A3C9SDM1TKNS65 |
24 |
24 |
72 |
120 |
| A3CP03KUNUMEWF |
24 |
24 |
72 |
120 |
| A3I448WWTX2A2D |
24 |
24 |
72 |
120 |
| A3IBAGEKMDEGSI |
24 |
24 |
72 |
120 |
| A3JMLA0FWLP0WA |
24 |
24 |
72 |
120 |
| A3KCAT0C3NWVDX |
24 |
24 |
72 |
120 |
| A3PLWSCPFLCEGI |
24 |
24 |
72 |
120 |
| A3QT2DS5XYKYHU |
24 |
24 |
72 |
120 |
| A4I69DE7BI20I |
24 |
24 |
73 |
121 |
| A8C3WNWRBWUXO |
24 |
24 |
72 |
120 |
| AA8PZKO9XGCKO |
24 |
24 |
72 |
120 |
| ABYFMKPTF0SHG |
24 |
24 |
72 |
120 |
| AMPMTF5IAAMK8 |
24 |
24 |
72 |
120 |
| ANV9R86DM2YG5 |
24 |
24 |
72 |
120 |
| AQMJMYR9MANOG |
24 |
24 |
72 |
120 |
| ASL9UNVWVM9AW |
24 |
24 |
72 |
120 |
Plot the overall accuracy at the group level (collasped across workerId and condition).
tbl_overall_good_acc <- (tbl_good_catch_acc_all_main_acc_counts$sum / tbl_good_catch_acc_all_main_acc_counts_original$sum)
tbl_overall_good_acc <- cbind.data.frame(tbl_good_catch_acc_all_main_acc_counts[,1], tbl_overall_good_acc)
colnames(tbl_overall_good_acc) <- c("workerId", "main_rate")
kable(tbl_overall_good_acc)
| A10AVWALIHR4UQ |
0.4583333 |
| A12FTSX85NQ8N9 |
0.5666667 |
| A1916FQFP74ED6 |
0.5333333 |
| A198MSVO1VTAT5 |
0.6583333 |
| A1BNYBF79IQ89T |
0.4333333 |
| A1CNTYNF0MIBK8 |
0.4583333 |
| A1EBGIM9CZTQLX |
0.5750000 |
| A1F3XD5WEK7H7E |
0.5083333 |
| A1G4MDRJ3Y36DA |
0.4500000 |
| A1P2RQ166VS5BT |
0.4750000 |
| A25N8DM670K4MA |
0.5546218 |
| A26LOVXF4QZZCO |
0.6416667 |
| A28AXX4NCWPH1F |
0.6000000 |
| A28RKM9Q1FIZEK |
0.3916667 |
| A2F2DDH12YU4AK |
0.3750000 |
| A2MUCL20GTQJA0 |
0.6916667 |
| A2NO3OTBZYY43Z |
0.6750000 |
| A2V27A9GZA1NR2 |
0.7083333 |
| A386U6K4J1ANQI |
0.6000000 |
| A3B9QNYDDXGL9I |
0.6166667 |
| A3C9SDM1TKNS65 |
0.5083333 |
| A3CP03KUNUMEWF |
0.6416667 |
| A3I448WWTX2A2D |
0.5583333 |
| A3IBAGEKMDEGSI |
0.4416667 |
| A3JMLA0FWLP0WA |
0.4833333 |
| A3KCAT0C3NWVDX |
0.1833333 |
| A3PLWSCPFLCEGI |
0.9583333 |
| A3QT2DS5XYKYHU |
0.2500000 |
| A4I69DE7BI20I |
0.3057851 |
| A8C3WNWRBWUXO |
0.6416667 |
| AA8PZKO9XGCKO |
0.9000000 |
| ABYFMKPTF0SHG |
0.5000000 |
| AMPMTF5IAAMK8 |
0.6083333 |
| ANV9R86DM2YG5 |
0.4333333 |
| AQMJMYR9MANOG |
0.5000000 |
| ASL9UNVWVM9AW |
0.5000000 |
tbl_overall_good_acc %>%
ggbarplot(y = "main_rate", ylab = "Accuracy", fill = "#f7a800", color = "#f7a800", add = "mean_se", ylim = c(0, 1), xlab = "Group", width = 0.5, label = TRUE, lab.nb.digits = 2, lab.vjust = -2, title = "Main Trial Accuracy")

Main trial accuracy relative to chance performance
chance <- t.test(tbl_overall_good_acc$main_rate, mu = .50, alternative="greater")
chance
##
## One Sample t-test
##
## data: tbl_overall_good_acc$main_rate
## t = 1.5059, df = 35, p-value = 0.07053
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
## 0.495306 Inf
## sample estimates:
## mean of x
## 0.5384835
Accuracy over time
Look at the overall accuracy at the group level (collasped across workerId and condition) over time.
tbl_good_no_NA_bin <- tbl_good_catch_acc_all_main_acc %>%
group_by(workerId,validity,bin) %>%
filter(validity=='valid' | validity=='invalid_same' | validity=='invalid_different') %>%
dplyr::summarize(counts = n()) %>%
spread(validity,counts)
tbl_good_no_NA_bin$sum = rowSums(tbl_good_no_NA_bin[,c(-1:-2)], na.rm = TRUE)
#head(tbl_good_no_NA_bin,10)
tbl_overall_good_acc_bin <- (tbl_good_catch_acc_all_main_acc_counts_bin$sum / tbl_all_change_counts_no_catch_bin$sum)
tbl_overall_good_acc_bin <- cbind.data.frame(tbl_good_no_NA_bin[,1:2], tbl_overall_good_acc_bin)
colnames(tbl_overall_good_acc_bin) <- c("workerId", "bin", "ACC")
tbl_overall_good_acc_bin %>%
ggline(y = "ACC", x = "bin", ylab = "Accuracy", fill = "#f7a800", color = "#f7a800", add = "mean_se", ylim = c(0, 1), xlab = " Bin", title = "Main Trial Accuracy Over Time", na.rm = TRUE)

Here are some descriptive and inferential statistics (repeated measures ANOVA and post-hoc t-tests) for the effect of accuracy over time.
aov_acc_time <- aov(ACC ~ bin + Error(factor(workerId)/bin), tbl_overall_good_acc_bin)
summary(aov_acc_time)
##
## Error: factor(workerId)
## Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 35 5.782 0.1652
##
## Error: factor(workerId):bin
## Df Sum Sq Mean Sq F value Pr(>F)
## bin 1 0.000 0.00001 0 0.989
## Residuals 35 1.269 0.03626
##
## Error: Within
## Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 180 3.674 0.02041
pwc_acc_time <- tbl_overall_good_acc_bin %>%
pairwise_t_test(
ACC ~ bin, paired = TRUE,
p.adjust.method = "bonferroni"
)
pwc_acc_time
## # A tibble: 21 x 10
## .y. group1 group2 n1 n2 statistic df p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <chr>
## 1 ACC 1 2 36 36 -0.263 35 0.794 1 ns
## 2 ACC 1 3 36 36 -1.60 35 0.118 1 ns
## 3 ACC 1 4 36 36 -0.763 35 0.45 1 ns
## 4 ACC 1 5 36 36 -0.718 35 0.478 1 ns
## 5 ACC 1 6 36 36 -0.563 35 0.577 1 ns
## 6 ACC 1 7 36 36 -0.0102 35 0.992 1 ns
## 7 ACC 2 3 36 36 -1.13 35 0.265 1 ns
## 8 ACC 2 4 36 36 -0.357 35 0.723 1 ns
## 9 ACC 2 5 36 36 -0.354 35 0.725 1 ns
## 10 ACC 2 6 36 36 -0.386 35 0.702 1 ns
## # … with 11 more rows
Accuracy by validty
Look at the overall accuracy for the group by validity (valid, invalid-same etc.).
tbl_overall_good_acc_cond <- (tbl_good_catch_acc_all_main_acc_counts[-1] / tbl_good_catch_acc_all_main_acc_counts_original[-1])
tbl_overall_good_acc_cond <- cbind.data.frame(tbl_good_catch_acc_all_main_acc_counts[,1], tbl_overall_good_acc_cond)
tbl_overall_good_acc_cond <- gather(tbl_overall_good_acc_cond, validity, acc, valid:invalid_different, factor_key=TRUE)
tbl_overall_good_acc_cond %>%
ggbarplot(x = "validity", y = "acc", ylab = "Accuracy", fill = "validity" , color = "validity", palette = c("#0d2240", "#00a8e1", "#f7a800", "#E31818", "#dfdddc"), add = "mean_se", ylim = c(0, 1), na.rm = TRUE, label = TRUE, lab.nb.digits = 2, lab.vjust = c(-2.5, -2.5, -2.5), title = "Main Trial Accuracy By Validity", xlab = "Validity")

Here are some descriptive and inferential statistics (repeated measures ANOVA and post-hoc t-tests) for the effect of accuracy by validty.
tbl_overall_good_acc_cond %>%
group_by(validity) %>%
get_summary_stats(acc, type = "mean_se")
## # A tibble: 3 x 5
## validity variable n mean se
## <fct> <chr> <dbl> <dbl> <dbl>
## 1 valid acc 36 0.61 0.036
## 2 invalid_same acc 36 0.435 0.038
## 3 invalid_different acc 36 0.427 0.039
aov_acc_validity <- aov(acc ~ validity + Error(factor(workerId)/validity), tbl_overall_good_acc_cond)
summary(aov_acc_validity)
##
## Error: factor(workerId)
## Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 35 2.742 0.07834
##
## Error: factor(workerId):validity
## Df Sum Sq Mean Sq F value Pr(>F)
## validity 2 0.7693 0.3847 9.96 0.000156 ***
## Residuals 70 2.7035 0.0386
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
tbl_overall_good_acc_cond %>%
filter(validity == "valid" | validity == "invalid_same") %>%
with(t.test(acc~validity,paired=TRUE))
##
## Paired t-test
##
## data: acc by validity
## t = 3.1254, df = 35, p-value = 0.00356
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.06127752 0.28842879
## sample estimates:
## mean of the differences
## 0.1748532
tbl_overall_good_acc_cond %>%
filter(validity == "invalid_same" | validity == "invalid_different") %>%
with(t.test(acc~validity,paired=TRUE))
##
## Paired t-test
##
## data: acc by validity
## t = 0.41573, df = 35, p-value = 0.6801
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.03146148 0.04766518
## sample estimates:
## mean of the differences
## 0.008101852
Individual subject accuracy
Third, we can look at the accuracy for each individual subject. The dashed line at 0.50 represents chance.
tbl_overall_good_acc %>%
ggbarplot(x = "workerId", y = "main_rate", ylab = "Accuracy", fill = "#f7a800", color = "#f7a800", ylim = c(0, 1), title = "Individual Accuracy", sort.val = c("asc"), font.xtickslab = 8) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2)

Accuracy on no-change trials
Count the count of accurate no-change trials. The subject pressed ‘J’.
tbl_good_catch_acc_all_main_no_change_acc_counts <- tbl_all_no_change_acc %>%
filter(validity=='valid' & acc == 1) %>%
group_by(workerId) %>%
dplyr::summarize(counts = n())
tbl_good_catch_acc_all_main_no_change_acc_counts[is.na(tbl_good_catch_acc_all_main_no_change_acc_counts)] <- 0
colnames(tbl_good_catch_acc_all_main_no_change_acc_counts) <- c("workerId", "acc_no_change")
kable(tbl_good_catch_acc_all_main_no_change_acc_counts)
| A10AVWALIHR4UQ |
40 |
| A12FTSX85NQ8N9 |
37 |
| A1916FQFP74ED6 |
12 |
| A198MSVO1VTAT5 |
33 |
| A1BNYBF79IQ89T |
1 |
| A1CNTYNF0MIBK8 |
19 |
| A1EBGIM9CZTQLX |
37 |
| A1F3XD5WEK7H7E |
37 |
| A1G4MDRJ3Y36DA |
19 |
| A1P2RQ166VS5BT |
38 |
| A25N8DM670K4MA |
23 |
| A26LOVXF4QZZCO |
40 |
| A28AXX4NCWPH1F |
39 |
| A28RKM9Q1FIZEK |
16 |
| A2F2DDH12YU4AK |
36 |
| A2MUCL20GTQJA0 |
38 |
| A2NO3OTBZYY43Z |
40 |
| A2V27A9GZA1NR2 |
28 |
| A386U6K4J1ANQI |
15 |
| A3B9QNYDDXGL9I |
36 |
| A3C9SDM1TKNS65 |
18 |
| A3CP03KUNUMEWF |
8 |
| A3I448WWTX2A2D |
14 |
| A3IBAGEKMDEGSI |
23 |
| A3JMLA0FWLP0WA |
22 |
| A3KCAT0C3NWVDX |
12 |
| A3PLWSCPFLCEGI |
40 |
| A3QT2DS5XYKYHU |
23 |
| A4I69DE7BI20I |
27 |
| A8C3WNWRBWUXO |
39 |
| AA8PZKO9XGCKO |
40 |
| ABYFMKPTF0SHG |
16 |
| AMPMTF5IAAMK8 |
33 |
| ANV9R86DM2YG5 |
24 |
| AQMJMYR9MANOG |
24 |
| ASL9UNVWVM9AW |
21 |
Compute the no-change accuracy rate.
tbl_no_change_acc_rate <- (tbl_good_catch_acc_all_main_no_change_acc_counts$acc_no_change / tbl_all_no_change_counts$no_change_total_sum)
tbl_no_change_acc_rate <- cbind.data.frame(tbl_good_catch_acc_all_main_no_change_acc_counts[,1], tbl_no_change_acc_rate)
colnames(tbl_no_change_acc_rate) <- c("workerId", "no_change_rate")
kable(tbl_no_change_acc_rate)
| A10AVWALIHR4UQ |
1.000 |
| A12FTSX85NQ8N9 |
0.925 |
| A1916FQFP74ED6 |
0.300 |
| A198MSVO1VTAT5 |
0.825 |
| A1BNYBF79IQ89T |
0.025 |
| A1CNTYNF0MIBK8 |
0.475 |
| A1EBGIM9CZTQLX |
0.925 |
| A1F3XD5WEK7H7E |
0.925 |
| A1G4MDRJ3Y36DA |
0.475 |
| A1P2RQ166VS5BT |
0.950 |
| A25N8DM670K4MA |
0.575 |
| A26LOVXF4QZZCO |
1.000 |
| A28AXX4NCWPH1F |
0.975 |
| A28RKM9Q1FIZEK |
0.400 |
| A2F2DDH12YU4AK |
0.900 |
| A2MUCL20GTQJA0 |
0.950 |
| A2NO3OTBZYY43Z |
1.000 |
| A2V27A9GZA1NR2 |
0.700 |
| A386U6K4J1ANQI |
0.375 |
| A3B9QNYDDXGL9I |
0.900 |
| A3C9SDM1TKNS65 |
0.450 |
| A3CP03KUNUMEWF |
0.200 |
| A3I448WWTX2A2D |
0.350 |
| A3IBAGEKMDEGSI |
0.575 |
| A3JMLA0FWLP0WA |
0.550 |
| A3KCAT0C3NWVDX |
0.300 |
| A3PLWSCPFLCEGI |
1.000 |
| A3QT2DS5XYKYHU |
0.575 |
| A4I69DE7BI20I |
0.675 |
| A8C3WNWRBWUXO |
0.975 |
| AA8PZKO9XGCKO |
1.000 |
| ABYFMKPTF0SHG |
0.400 |
| AMPMTF5IAAMK8 |
0.825 |
| ANV9R86DM2YG5 |
0.600 |
| AQMJMYR9MANOG |
0.600 |
| ASL9UNVWVM9AW |
0.525 |
Generate plots of the average no-change accuracy rate for the group and each individual’s no-change accuracy rate.
tbl_no_change_acc_rate %>%
ggbarplot(y = "no_change_rate", ylab = "Accuracy", fill = "#f7a800", color = "#f7a800", add = "mean_se", ylim = c(0, 1), xlab = "Group", width = 0.5, label = TRUE, lab.nb.digits = 2, lab.vjust = -2, title = "No Change Trial Accuracy")

tbl_no_change_acc_rate %>%
ggbarplot(x = "workerId", y = "no_change_rate", ylab = "Accuracy", fill = "#f7a800", color = "#f7a800", ylim = c(0, 1), title = "Individual No Change Trial Accuracy", sort.val = c("asc"), font.xtickslab = 8) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2)

Correlations between catch, change, and no-change trials
tbl_corr <- cbind.data.frame(tbl_all_catch_acc_rate[2], tbl_overall_good_acc[2], tbl_no_change_acc_rate[2])
tbl_corr_output <- rcorr(as.matrix(tbl_corr))
tbl_corr_output
## catch_rate main_rate no_change_rate
## catch_rate 1.00 0.57 0.62
## main_rate 0.57 1.00 0.46
## no_change_rate 0.62 0.46 1.00
##
## n= 36
##
##
## P
## catch_rate main_rate no_change_rate
## catch_rate 0.0003 0.0000
## main_rate 0.0003 0.0047
## no_change_rate 0.0000 0.0047
tbl_corr %>%
ggscatter(x = "catch_rate", y = "main_rate", add = "reg.line", title = "Correlation Between Catch and Main Trial Accuracies", ylim = c(0, 1), xlim = c(0, 1), add.params = list(color = "blue", fill = "lightgray")) + stat_cor(method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

tbl_corr %>%
ggscatter(x = "catch_rate", y = "no_change_rate", add = "reg.line", title = "Correlation Between Catch and No Change Trial Accuracies", ylim = c(0, 1), xlim = c(0, 1), add.params = list(color = "blue", fill = "lightgray")) + stat_cor(method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

tbl_corr %>%
ggscatter(x = "main_rate", y = "no_change_rate", add = "reg.line", title = "Correlation Between Main Trial and No Change Trial Accuracies", ylim = c(0, 1), xlim = c(0, 1), add.params = list(color = "blue", fill = "lightgray")) + stat_cor(method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

Difference between catch, change, and no-change trials
tbl_corr <- gather(tbl_corr, rate_type, rate, catch_rate:no_change_rate, factor_key=TRUE)
tbl_corr %>%
filter(rate_type == "catch_rate" | rate_type == "main_rate") %>%
with(t.test(rate~rate_type,paired=TRUE))
##
## Paired t-test
##
## data: rate by rate_type
## t = 3.1615, df = 35, p-value = 0.003235
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04228157 0.19402299
## sample estimates:
## mean of the differences
## 0.1181523
tbl_corr %>%
filter(rate_type == "catch_rate" | rate_type == "no_change_rate") %>%
with(t.test(rate~rate_type,paired=TRUE))
##
## Paired t-test
##
## data: rate by rate_type
## t = -0.38891, df = 35, p-value = 0.6997
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.09694738 0.06577454
## sample estimates:
## mean of the differences
## -0.01558642
tbl_corr %>%
filter(rate_type == "main_rate" | rate_type == "no_change_rate") %>%
with(t.test(rate~rate_type,paired=TRUE))
##
## Paired t-test
##
## data: rate by rate_type
## t = -3.2483, df = 35, p-value = 0.002564
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.21732142 -0.05015597
## sample estimates:
## mean of the differences
## -0.1337387