-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVME_mainAnalysis.Rmd
1029 lines (827 loc) · 42.8 KB
/
VME_mainAnalysis.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "VME Analysis_R manuscript"
author: "Felix Klotzsche, Sven Ohl"
date: "8 6 2021"
output:
html_document:
code_folding: hide
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Intro
This file prints relevant statistics and plots of the vMemEcc manuscript. Please note, analyses and plots produced in Python are not included here - but in a separate notebook. The most relevant chunkcs of the source code are included in this file as well. For the full code base, please refer to the [repository on GitHub](https://github.com/eioe/vMemEcc-Analyses).
## Requirements
We ran these analyses using version 4.1.0 (2021-05-18) in RStudio v1.4.1717.
## Init workspace
Loads packages, custom functions, custom themes, and data.
Data is made availbale in the workspace as data frame `data_behav`.
* **ppid** (chr): subject id (e.g., "VME_S09")
* **trial_num** (num): index of the trial in the experiment (includes all trials from all blocks; also training)
"perception" block: 11-82
vSTM block ("experiment"): 93-812
* **block_num** (num): index of the block
* **c_StimN** (num): number of memory items (2 or 4)
* **c_Ecc** (num): stimulus eccentricity (4, 9, 14)
* **c_ResponseCorrect** (logi): correctness of response in this trial
* **c_ResponseTime** (num): RT
* **BlockStyle** (chr): denotes if trial was in "perception" or vSTM ("experiment") block
* **CDA_amp_<cluster/fixed>times** (num): avg. CDA amplitude in this trial (see paper for spec. of ROI and time window).
* **PNP_amp_<cluster/fixed>times** (num): avg. PNP amplitude in this trial (see paper for spec. of ROI and time window)
* **alphapwr_diff_retent** (num): avg. lateralized alpha power in this trial (see paper for spec. of freq. band, ROI and time window)
```{r init, message=FALSE, warning=FALSE, echo=TRUE}
#--------------------------------------------------------------------------
# Run main script for analysis for:
# vMemEcc
#--------------------------------------------------------------------------
library(here)
library(knitr)
#--------------------------------------------------------------------------
# Define pathes
path_global <- here('../..')
path_r_data <- file.path(path_global, 'Data/DataR')
path_scripts_sven <- file.path(here('Workflow_Sven',
'osf_experiment1',
'_RScripts'))
path_extracted_vars <- file.path(here('../VME_extracted_vars.json'))
# path_global, 'Writing',
# 'Other',
# 'VME_extracted_vars.json')
#--------------------------------------------------------------------------
## load packages & custom utils:
source(here("Utils", "load_packages.R"))
source(here('Utils', 'print_output.R'))
source(here('Utils', 'utils_report.R'))
source(here('Utils', 'calc_conf_intervalls.R'))
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
## define colors
source(file.path(path_scripts_sven, "loadColors.R"))
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
## load function to compute confidence intervals
source(file.path(path_scripts_sven,"loadFunctions.R"))
source(file.path(here('Utils', 'load_functions.R')))
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
## load theme
source(file.path(path_scripts_sven, "loadTheme.R"))
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
## load data, assign names for columns and define variable type
source(file.path(here('Utils', 'load_data.R')))
#--------------------------------------------------------------------------
# Write
extract_var("r_version", "v4.1.0", exp_format = "%s")
extract_var("rstudio_version", "v1.4.1717", exp_format = "%s")
```
## Summary stats:
**Extract relevants descriptives about the data set.**
```{r, desc stats}
# Total number of experimental trials (720 x n):
n_rej_subs <- 3
print(str_glue("N rejected subjects: {n_rej_subs}"))
n_subs_analyzed <- length(unique(data_behav$ppid))
n_tot_trials <- 720 * (n_subs_analyzed + n_rej_subs)
n_tot_trials_prerej <- 720 * n_subs_analyzed
print(str_glue("Total number of recorded experimental trials (720 x {n_subs_analyzed + n_rej_subs}): {n_tot_trials}"))
print(str_glue("Total number of experimental trials after subject rejection (720 x {n_subs_analyzed}): {n_tot_trials_prerej}"))
n_tot_trials_postrej <- data_behav %>% filter(BlockStyle == 'experiment') %>% drop_na() %>% nrow()
n_trials_rejected <- n_tot_trials_prerej - n_tot_trials_postrej
print(str_glue("Total number of trials after rejection: {n_tot_trials_postrej} ({n_trials_rejected} trials rejected)"))
data_behav_per_task <- vector(mode = "list", length = 2)
data_behav_per_task[['exp']] <- data_behav %>%
filter(BlockStyle == 'experiment') %>%
drop_na() %>%
group_by(ppid, c_StimN, c_Ecc) %>%
mutate(dprime = qnorm(mean(c(Hit, 0.5))) - qnorm(mean(c(FalseAlarm, 0.5)))) %>%
ungroup()
data_behav_per_task[['perc']] <- data_behav %>%
filter(BlockStyle == 'perception') %>%
# select(!contains(c('CDA_amp', 'PNP_amp', 'alphapwr_diff_retent'))) %>%
select(ppid, trial_num, block_num, c_StimN, c_Ecc, c_ResponseCorrect, c_ResponseTime, BlockStyle, Hit, FalseAlarm, CorrRej, Miss) %>%
drop_na() %>%
group_by(ppid, c_StimN, c_Ecc) %>%
mutate(dprime = qnorm(mean(c(Hit, 0.5))) - qnorm(mean(c(FalseAlarm, 0.5)))) %>%
ungroup()
# Summary remaining trials:
summary_rem_trials_per_sub <- data_behav_per_task[['exp']] %>%
group_by(ppid) %>%
summarise(n_trials_remaining = n(),
perc_trials_remaining = n_trials_remaining*100 / 720,
.groups = "drop")
print(str_glue("Remaining trials per subject (percentage):
mean: {mean(summary_rem_trials_per_sub$n_trials_remaining)} ({format(mean(summary_rem_trials_per_sub$perc_trials_remaining), digits=3)}%)
range: {min(summary_rem_trials_per_sub$n_trials_remaining)} ({format(min(summary_rem_trials_per_sub$perc_trials_remaining), digits=3)}%) - {max(summary_rem_trials_per_sub$n_trials_remaining)} ({format(max(summary_rem_trials_per_sub$perc_trials_remaining), digits=3)}%)\n\n"))
acc_overall <- vector(mode = "list", length = 2)
stats_overall <- vector(mode = "list", length = 2)
acc_per_memLoad <- vector(mode = "list", length = 2)
stats_memLoad <- vector(mode = "list", length = 2)
acc_per_ecc <- vector(mode = "list", length = 2)
stats_ecc <- vector(mode = "list", length = 2)
for (task in c('perc', 'exp')) {
if (task == "exp") {
outvars <- list("c_ResponseCorrect",
"dprime",
"CDA_amp_clustertimes",
"PNP_amp_clustertimes",
"alphapwr_diff_retent",
"maxDecodScore_sensorspace",
"maxDecodScoreTime_sensorspace",
"maxDecodScore_csp",
"maxDecodScoreTime_csp")
} else {
outvars <- list("c_ResponseCorrect", "dprime")
}
for (outvar in outvars) {
scaler = switch (outvar,
"c_ResponseCorrect" = 100,
"alphapwr_diff_retent" = 1e12,
"maxDecodScoreTime_sensorspace" = 1000,
"maxDecodScoreTime_csp" = 1000,
1
)
dv_str = switch (outvar,
"c_ResponseCorrect" = "mem_acc",
"dprime" = "dprime",
"alphapwr_diff_retent" = "alphalat",
"CDA_amp_clustertimes" = "cda",
"PNP_amp_clustertimes" = "pnp",
"maxDecodScore_sensorspace" = "decod_sensorspace_maxscore",
"maxDecodScoreTime_sensorspace" = "decod_sensorspace_maxscoretime",
"maxDecodScore_csp" = "decod_csp_maxscore",
"maxDecodScoreTime_csp" = "decod_csp_maxscoretime"
)
task_print <- if_else(task == "exp", "vSTM", "perception")
print("#####################################################")
print(str_glue("#### TASK: {task_print}"))
print("#####################################################")
# Summary accuracy overall:
tmp <- data_behav_per_task[[task]] %>%
group_by(ppid) %>%
summarise(perc_resp_corr = mean(get(outvar)) * scaler,
.groups = "drop"
) %>%
ungroup() %>%
select(!ppid)
# Here we cannot calculate Cousineau-Morey CIs, so we take normal CIs:
acc_overall[[task]][[outvar]] <- tmp %>%
summarise_all(list (mean = mean, sd = sd, min = min, max = max, ci95lower = ci95lower, ci95upper = ci95upper))
rm(tmp)
stats_overall[[task]][[outvar]] <- list(
name = "overall",
printName = "overall",
levels = c(""),
stats = acc_overall[[task]][[outvar]]
)
# Summary per Memory Load:
tmp <- data_behav_per_task[[task]] %>%
group_by(ppid, c_StimN) %>%
summarise(perc_resp_corr = mean(get(outvar)) * scaler,
.groups = "drop") %>%
pivot_wider(names_from = c_StimN,
values_from = perc_resp_corr,
names_prefix = "StimN_") %>%
ungroup() %>%
select(!ppid)
acc_per_memLoad[[task]][[outvar]] <- tmp %>%
summarise_all(list (mean = mean, sd = sd, min = min, max = max, ci95lower = ci95lower, ci95upper = ci95upper))
# Add Cousineau-Morey CIs:
cmci95 <- cm.ci(tmp, difference = TRUE, conf.level = 0.95)
for (l in colnames(tmp)) {
for (bound in c("lower", "upper")) {
acc_per_memLoad[[task]][[outvar]][1, str_c(l, '_cmci95', bound)] <- cmci95[rownames(cmci95)==l, colnames(cmci95)==bound]
}
}
rm(cmci95, tmp)
stats_memLoad[[task]][[outvar]] <- list(
name = "StimN",
printName = "memLoad",
levels = str_c("StimN_", unique(data_behav_per_task[[task]]$c_StimN), '_'),
stats = acc_per_memLoad[[task]][[outvar]]
)
# Summary per Ecc:
tmp <- data_behav_per_task[[task]] %>%
group_by(ppid, c_Ecc) %>%
summarise(perc_resp_corr = mean(get(outvar)) * scaler,
.groups = "drop") %>%
pivot_wider(names_from = c_Ecc,
values_from = perc_resp_corr,
names_prefix = "Ecc_") %>%
ungroup() %>%
select(!ppid)
acc_per_ecc[[task]][[outvar]] <- tmp %>%
summarise_all(list (mean = mean, sd = sd, min = min, max = max, ci95lower = ci95lower, ci95upper = ci95upper))
# Add Cousineau-Morey CIs:
cmci95 <- cm.ci(tmp, difference = TRUE, conf.level = 0.95)
for (l in colnames(tmp)) {
for (bound in c("lower", "upper")) {
acc_per_ecc[[task]][[outvar]][1, str_c(l, '_cmci95', bound)] <- cmci95[rownames(cmci95)==l, colnames(cmci95)==bound]
}
}
rm(cmci95, tmp)
stats_ecc[[task]][[outvar]] <- list(
name = "ecc",
printName = "Ecc",
levels = str_c("Ecc_", sort(unique(data_behav_per_task[[task]]$c_Ecc)), '_'),
stats = acc_per_ecc[[task]][[outvar]]
)
print(" **********************************************")
print(str_glue(" ****** Dep. varibale: {outvar}"))
print(" **********************************************")
for (tmp in list(stats_overall[[task]][[outvar]], stats_memLoad[[task]][[outvar]], stats_ecc[[task]][[outvar]])) {
print(str_glue("DV ({if_else(str_detect(tmp$printName, 'overall'), '', 'by ')}{tmp$printName}):\n"))
for (lvl in tmp$levels) {
if (length(tmp$levels) > 1) print(str_glue("{tmp$printName} == {parse_number(lvl)}:"))
print(str_glue(" mean (%): {tmp$stats[str_c(lvl, 'mean')]}"))
print(str_glue(" SD (%): {tmp$stats[str_c(lvl, 'sd')]}"))
print(str_glue(" min (%): {tmp$stats[str_c(lvl, 'min')]}"))
print(str_glue(" max (%): {tmp$stats[str_c(lvl, 'max')]}"))
print(str_glue(" 95% CI(%): {tmp$stats[str_c(lvl, 'ci95lower')]} - {tmp$stats[str_c(lvl, 'ci95upper')]}"))
if (tmp$name != "overall") {
print(str_glue(" 95% Cousineau-Morey CI(%): {tmp$stats[str_c(lvl, 'cmci95lower')]} - {tmp$stats[str_c(lvl, 'cmci95upper')]}"))
}
}
cat("\n\n")
}
## Pairwise differences of the mean (with regular CIs):
tmp_df <- data_behav_per_task[[task]] %>%
group_by(ppid, c_StimN) %>%
summarise(perc_resp_corr = mean(get(outvar)) * scaler,
.groups = "drop") %>%
pivot_wider(names_from = c_StimN,
values_from = perc_resp_corr,
names_prefix = "StimN_",
id_cols = ppid) %>%
mutate(diff = StimN_2 - StimN_4) %>%
ungroup() %>%
select(!ppid) %>%
summarise_all(.funs = c(mean=mean, sd=sd, ci95lower=ci95lower, ci95upper=ci95upper))
print("Difference between Memory Load conditions:")
print(str_glue(" Mean (CI): {format(tmp_df$diff_mean, digits=3)} ({format(tmp_df$diff_ci95lower, digits=3)} - {format(tmp_df$diff_ci95upper, digits=3)})"))
extract_var(str_glue("{dv_str}_{task}_delta_StimN2vsStimN4_mean"), tmp_df$diff_mean, exp_format="%.2f")
extract_var(str_glue("{dv_str}_{task}_delta_StimN2vsStimN4_cilower"), tmp_df$diff_ci95lower, exp_format="%.2f")
extract_var(str_glue("{dv_str}_{task}_delta_StimN2vsStimN4_ciupper"), tmp_df$diff_ci95upper, exp_format="%.2f")
cat("\n\n")
tmp_df <- data_behav_per_task[[task]] %>%
group_by(ppid, c_Ecc) %>%
summarise(perc_resp_corr = mean(get(outvar)) * scaler,
.groups = "drop") %>%
pivot_wider(names_from = c_Ecc,
values_from = perc_resp_corr,
names_prefix = "Ecc_",
id_cols = ppid) %>%
mutate(diff_Ecc4vsEcc9 = Ecc_4 - Ecc_9,
diff_Ecc4vsEcc14 = Ecc_4 - Ecc_14,
diff_Ecc9vsEcc14 = Ecc_9 - Ecc_14) %>%
ungroup() %>%
select(!ppid) %>%
summarise_all(.funs = c(mean=mean,
sd=sd,
ci95lower=ci95lower,
ci95upper=ci95upper,
t_stat_t= ~ summarize_ttest(x = ., returnval = "t"),
t_stat_p= ~ summarize_ttest(x = ., returnval = "p")))
print("Difference between Eccentricity conditions:")
contrast_pairs <- list(c("4", "9"), c("4", "14"), c("9", "14"))
for (cp in contrast_pairs) {
print(str_glue(" Contrast: {cp[1]} - {cp[2]}"))
print(str_glue(". Mean (%): {format(tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_mean')]], digits=3)}
. CI (%): ({format(tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_ci95lower')]], digits=3)} - {format(tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_ci95upper')]], digits=3)})"))
extract_var(str_glue("{dv_str}_{task}_delta_Ecc{cp[1]}vsEcc{cp[2]}_mean"), tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_mean')]], exp_format="%.2f")
extract_var(str_glue("{dv_str}_{task}_delta_Ecc{cp[1]}vsEcc{cp[2]}_cilower"), tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_ci95lower')]], exp_format="%.2f")
extract_var(str_glue("{dv_str}_{task}_delta_Ecc{cp[1]}vsEcc{cp[2]}_ciupper"), tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_ci95upper')]], exp_format="%.2f")
extract_var(str_glue("{dv_str}_{task}_delta_Ecc{cp[1]}vsEcc{cp[2]}_t"), tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_t_stat_t')]], exp_format="%.2f")
extract_var(str_glue("{dv_str}_{task}_delta_Ecc{cp[1]}vsEcc{cp[2]}_p"), tmp_df[[str_glue('diff_Ecc', cp[1], 'vsEcc', cp[2], '_t_stat_p')]], exp_format="%.3f", is_pval = TRUE)
}
cat("\n\n")
}
}
extract_var("n_rej_subs", n_rej_subs, exp_format = "%i")
extract_var("n_tot_trials_prerej_allsubs", 720 * (n_subs_analyzed + n_rej_subs), exp_format = "%i")
extract_var("n_subs_analyzed", n_subs_analyzed, exp_format = "%i")
extract_var("n_tot_trials_prerej", n_tot_trials_prerej, exp_format = "%i")
extract_var("n_trials_rejected", n_tot_trials_prerej - n_tot_trials_postrej, exp_format = "%i")
extract_var("n_tot_trials_postrej", n_tot_trials_postrej, exp_format = "%i")
extract_var("avg_n_trials_per_sub_postrej", mean(summary_rem_trials_per_sub$n_trials_remaining), exp_format="%.2f")
extract_var("min_n_trials_per_sub_postrej", min(summary_rem_trials_per_sub$n_trials_remaining), exp_format="%i")
extract_var("max_n_trials_per_sub_postrej", max(summary_rem_trials_per_sub$n_trials_remaining), exp_format="%i")
extract_var("avg_perc_trials_per_sub_postrej", mean(summary_rem_trials_per_sub$perc_trials_remaining), exp_format="%.2f")
extract_var("min_perc_trials_per_sub_postrej", min(summary_rem_trials_per_sub$perc_trials_remaining), exp_format="%.2f")
extract_var("max_perc_trials_per_sub_postrej", max(summary_rem_trials_per_sub$perc_trials_remaining), exp_format="%.2f")
for(task in c("exp", "perc")) {
if (task == "exp") {
outvars <- list("c_ResponseCorrect",
"dprime",
"CDA_amp_clustertimes",
"PNP_amp_clustertimes",
"alphapwr_diff_retent",
"maxDecodScore_sensorspace",
"maxDecodScoreTime_sensorspace",
"maxDecodScore_csp",
"maxDecodScoreTime_csp")
} else {
outvars <- list("c_ResponseCorrect", "dprime")
}
for (outvar in outvars) {
dv_str = switch (outvar,
"c_ResponseCorrect" = "mem_acc",
"dprime" = "dprime",
"alphapwr_diff_retent" = "alphalat",
"CDA_amp_clustertimes" = "cda",
"PNP_amp_clustertimes" = "pnp",
"maxDecodScore_sensorspace" = "decod_sensorspace_maxscore",
"maxDecodScoreTime_sensorspace" = "decod_sensorspace_maxscoretime",
"maxDecodScore_csp" = "decod_csp_maxscore",
"maxDecodScoreTime_csp" = "decod_csp_maxscoretime"
)
for (tmp in list(stats_overall[[task]][[outvar]], stats_memLoad[[task]][[outvar]], stats_ecc[[task]][[outvar]])) {
for (lvl in tmp$levels) {
for (stat in c("mean", "sd", "min", "max", "ci95lower", "ci95upper", "cmci95lower", "cmci95upper")) {
# for the grand average, we skip the Cousineau-Morey CIs (as we could not calculate them):
if (tmp$name == "overall" && str_detect(stat, "cmci")) {
next
}
extract_var(str_glue("{dv_str}_{task}_{lvl}{stat}"), tmp$stats[str_c(lvl, stat)], exp_format="%.2f")
}
}
}
}
}
```
## Analysis 01:
**Is there an effect of workload or eccentricity on performance in the VSTM task and in the perception task?**
### VSTM Task:
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_01")
```
```{r func_analysis_01-source, eval = FALSE}
```
```{r, message=FALSE, warning=FALSE}
# VSTM task:
results_anova_behav_exp <- func_analysis_01('experiment')
```
_extract variables:_
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_behav_exp_eff_", eff_print, "_F"), summary(results_anova_behav_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_behav_exp_eff_", eff_print, "_df_within"), summary(results_anova_behav_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_exp_eff_", eff_print, "_df_resid"), summary(results_anova_behav_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_exp_eff_", eff_print, "_p"), summary(results_anova_behav_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### Perception task:
```{r, message=FALSE, warning=FALSE}
# perceptual Change Detection Task:
results_anova_behav_perc <- func_analysis_01('perception')
```
```{r func_analysis_01-source, eval = FALSE}
```
_extract variables:_
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_behav_perc_eff_", eff_print, "_F"), summary(results_anova_behav_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_behav_perc_eff_", eff_print, "_df_within"), summary(results_anova_behav_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_perc_eff_", eff_print, "_df_resid"), summary(results_anova_behav_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_perc_eff_", eff_print, "_p"), summary(results_anova_behav_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
## Analysis 01 - supplement I:
**Are the effects different, if we use a bias-corrected measure of change detection performance (here: d')?**
### VSTM Task:
```{r, message=FALSE, warning=FALSE}
# VSTM task:
results_anova_behav_dprime_exp <- func_analysis_01.1('experiment')
```
_extract variables:_
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_behav_dprime_exp_eff_", eff_print, "_F"), summary(results_anova_behav_dprime_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_behav_dprime_exp_eff_", eff_print, "_df_within"), summary(results_anova_behav_dprime_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_dprime_exp_eff_", eff_print, "_df_resid"), summary(results_anova_behav_dprime_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_dprime_exp_eff_", eff_print, "_p"), summary(results_anova_behav_dprime_exp$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### Perception Task:
```{r, message=FALSE, warning=FALSE}
# Perception task:
results_anova_behav_dprime_perc <- func_analysis_01.1('perception')
```
_extract variables:_
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_behav_dprime_perc_eff_", eff_print, "_F"), summary(results_anova_behav_dprime_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_behav_dprime_perc_eff_", eff_print, "_df_within"), summary(results_anova_behav_dprime_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_dprime_perc_eff_", eff_print, "_df_resid"), summary(results_anova_behav_dprime_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_behav_dprime_perc_eff_", eff_print, "_p"), summary(results_anova_behav_dprime_perc$aov.srt)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
## Analysis 01 - supplement II:
**Is there an effect of workload or eccentricity on RT in the VSTM task and in the perception task?**
This analysis was only conducted to exclude that a speed-acc trade-off is taking place. As we did not instruct participants to answer as fast as possible and due to imprecise temporal measurements of RTs with the VR hard- and software, we do not report this analysis in the paper.
### VSTM Task:
```{r, message=FALSE, warning=FALSE}
# VSTM task:
func_analysis_03('experiment')
```
### Perception Task:
```{r, message=FALSE, warning=FALSE}
# perceptual Change Detection Task:
func_analysis_03('perception')
```
## Analysis 02:
**Is there an effect of workload or eccentricity on mean CDA amplitude in the VSTM task?**
### CDA amplitude (rmANOVA):
```{r, message=FALSE, warning=FALSE}
results_anova_cda <- func_analysis_05(dep_variable = "CDA_amp_clustertimes")
```
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_05")
```
```{r func_analysis_05-source, eval = FALSE}
```
_extract variables:_
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
# TODO: it's really ugly to split up the exports between here and the function call. I feel bad but will change this only in future projects.
extract_var(str_c("anova_cda_eff_", eff_print, "_F"), summary(results_anova_cda)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_cda_eff_", eff_print, "_df_within"), summary(results_anova_cda)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_cda_eff_", eff_print, "_df_resid"), summary(results_anova_cda)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_cda_eff_", eff_print, "_p"), summary(results_anova_cda)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### Analysis 02 - Supplement 1: CDA amplitude (lmer):
A multilevel model confirms the results of the rmANOVA:
```{r, message=FALSE, warning=FALSE}
m1 <- func_analysis_07('experiment', dep_variable = 'CDA_amp_clustertimes')
print(summary(m1))
summary_df <- data.frame(coef(summary(m1)))
ci_df <- print_CI_lmer(m1)
summary_df <- merge(summary_df, ci_df, by = 0)
summary_df[, -c(1, 6)] <- round(summary_df[, -c(1, 6)], 2)
# round p-value to 3 digits:
summary_df[, 6] <- round(summary_df[, 6], 3)
summary_df$ci_formatted <- sprintf("[%.2f; %.2f]", summary_df$lower, summary_df$upper)
print(summary_df)
```
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_07")
```
```{r func_analysis_07-source, eval = FALSE}
```
### Analysis 02 - Supplement 2: CDA amplitude (a priori time window):
Same as the main CDA analysis (ANOVA) but this time on the mean CDA amplitude in the time winow taken from the literature (Hakim et al., 2019):
```{r, message=FALSE, warning=FALSE}
results_anova_cda_fixedtimes <- func_analysis_05(dep_variable = "CDA_amp_fixedtimes")
```
_extract variables:_
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
# TODO: it's really ugly to split up the exports between here and the function call. I feel bad but will change this only in future projects.
extract_var(str_c("anova_cda_fixedtimes_eff_", eff_print, "_F"), summary(results_anova_cda_fixedtimes)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_cda_fixedtimes_eff_", eff_print, "_df_within"), summary(results_anova_cda_fixedtimes)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_cda_fixedtimes_eff_", eff_print, "_df_resid"), summary(results_anova_cda_fixedtimes)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_cda_fixedtimes_eff_", eff_print, "_p"), summary(results_anova_cda_fixedtimes)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### Analysis 02 - Supplement 3: CDA amplitude (a priori time-window -- lmer):
A multilevel model confirms the results of the original rmANOVA:
```{r, message=FALSE, warning=FALSE}
m1 <- func_analysis_07('experiment', dep_variable = 'CDA_amp_fixedtimes')
print(summary(m1))
summary_df <- data.frame(coef(summary(m1)))
ci_df <- print_CI_lmer(m1)
summary_df <- merge(summary_df, ci_df, by = 0)
summary_df[, -c(1, 6)] <- round(summary_df[, -c(1, 6)], 2)
# round p-value to 3 digits:
summary_df[, 6] <- round(summary_df[, 6], 3)
summary_df$ci_formatted <- sprintf("[%.2f; %.2f]", summary_df$lower, summary_df$upper)
print(summary_df[, c(1, 2, 5, 4, 9, 6, 3, 7, 8)])
```
### Analysis 03: PNP amplitude (rmANOVA):
Testing the effects of _memory load_ and _eccentricity_ on the mean **PNP amplitude** (see [Papaioannou & Luck, 2020](https://onlinelibrary.wiley.com/doi/abs/10.1111/psyp.13532))
```{r, message=FALSE, warning=FALSE}
results_anova_pnp <- func_analysis_09(dep_variable = "PNP_amp_clustertimes")
```
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_pnp_eff_", eff_print, "_F"), summary(results_anova_pnp)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_pnp_eff_", eff_print, "_df_within"), summary(results_anova_pnp)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_pnp_eff_", eff_print, "_df_resid"), summary(results_anova_pnp)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_pnp_eff_", eff_print, "_p"), summary(results_anova_pnp)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
## Analysis 04:
**Is there an effect of workload or eccentricity on mean lateralized alpha power in the VSTM task?**
See paper for specifics of parameters re. frequency band, ROI, and time window that were used to calculate mean lateralized power (power **contralaterally - ipsilaterally**)
### lat. alpha power (rmANOVA):
```{r, message=FALSE, warning=FALSE}
results_anova_alphalat <- func_analysis_06()
```
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_06")
```
```{r func_analysis_06-source, eval = FALSE}
```
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_alphalat_eff_", eff_print, "_F"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_alphalat_eff_", eff_print, "_df_within"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_alphalat_eff_", eff_print, "_df_resid"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_alphalat_eff_", eff_print, "_p"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### Analysis 04 - Supplement 1: lat. alpha power (lmer):
A multilevel model confirms the results of the rmANOVA:
```{r, message=FALSE, warning=FALSE}
func_analysis_10('experiment', dep_variable = 'alpha_pwr')
```
### Analysis 04 - Supplement 2: global alpha power:
Effects of Memory Load and Eccentricity on non-lateralized alpha power.
```{r, message=FALSE, warning=FALSE}
results_anova_globalpha <- func_analysis_06.1()
```
```{r, echo=FALSE}
for (eff in c("c_StimN", "c_Ecc", "c_StimN:c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_globalpha_eff_", eff_print, "_F"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_globalpha_eff_", eff_print, "_df_within"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_globalpha_eff_", eff_print, "_df_resid"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_globalpha_eff_", eff_print, "_p"), summary(results_anova_alphalat)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
## Analysis 05:
**Is there an effect of stimulus eccentricity on the (max) decoding performance?
### Sensor space decoding (rmANOVA):
```{r, message=FALSE, warning=FALSE}
results_anova_decod_ss <- func_analysis_12()
```
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_12")
```
```{r func_analysis_12-source, eval = FALSE}
```
```{r, echo=FALSE}
for (eff in c("c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_decod_sensorspace_eff_", eff_print, "_F"), summary(results_anova_decod_ss)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_decod_sensorspace_eff_", eff_print, "_df_within"), summary(results_anova_decod_ss)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_sensorspace_eff_", eff_print, "_df_resid"), summary(results_anova_decod_ss)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_sensorspace_eff_", eff_print, "_p"), summary(results_anova_decod_ss)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### CSP decoding (rmANOVA):
```{r, message=FALSE, warning=FALSE}
results_anova_decod_csp <- func_analysis_14()
```
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_14")
```
```{r func_analysis_14-source, eval = FALSE}
```
```{r, echo=FALSE}
for (eff in c("c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_decod_csp_eff_", eff_print, "_F"), summary(results_anova_decod_csp)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_decod_csp_eff_", eff_print, "_df_within"), summary(results_anova_decod_csp)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_csp_eff_", eff_print, "_df_resid"), summary(results_anova_decod_csp)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_csp_eff_", eff_print, "_p"), summary(results_anova_decod_csp)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
## Analysis 05 - supplement:
**Is there an effect of stimulus eccentricity on the time of the max. decoding performance?
### Sensor space decoding (rmANOVA):
```{r, message=FALSE, warning=FALSE}
results_anova_decod_ss_time <- func_analysis_13()
```
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_13")
```
```{r func_analysis_13-source, eval = FALSE}
```
```{r, echo=FALSE}
for (eff in c("c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_decod_time_sensorspace_eff_", eff_print, "_F"), summary(results_anova_decod_ss_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_decod_time_sensorspace_eff_", eff_print, "_df_within"), summary(results_anova_decod_ss_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_time_sensorspace_eff_", eff_print, "_df_resid"), summary(results_anova_decod_ss_time)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_time_sensorspace_eff_", eff_print, "_p"), summary(results_anova_decod_ss_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### CSP decoding (rmANOVA):
```{r, message=FALSE, warning=FALSE}
results_anova_decod_csp_time <- func_analysis_15()
```
_show source:_
```{r, echo=FALSE}
# Code to chunk:
insert_fun("func_analysis_15")
```
```{r func_analysis_15-source, eval = FALSE}
```
```{r, echo=FALSE}
for (eff in c("c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_decod_time_csp_eff_", eff_print, "_F"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_decod_time_csp_eff_", eff_print, "_df_within"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_time_csp_eff_", eff_print, "_df_resid"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_decod_time_csp_eff_", eff_print, "_p"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
### Suppl. Analysis:
Is there an effect of workload or eccentricity on the number of rejected trials?
```{r, message=FALSE, warning=FALSE}
results_anova_rejtrials <- func_analysis_16()
```
```{r, echo=FALSE}
for (eff in c("c_Ecc")) {
eff_print <- eff %>%
str_replace_all("c_", "") %>%
str_replace_all(":", "x")
extract_var(str_c("anova_rejtrials_eff_", eff_print, "_F"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "F value"]])
extract_var(str_c("anova_rejtrials_eff_", eff_print, "_df_within"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Df"]],
exp_format = "%i")
extract_var(str_c("anova_rejtrials_eff_", eff_print, "_df_resid"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][["Residuals", "Df"]],
exp_format = "%i")
extract_var(str_c("anova_rejtrials_eff_", eff_print, "_p"), summary(results_anova_decod_csp_time)[[str_c("Error: ppid:", eff)]][[1]][[eff, "Pr(>F)"]],
is_pval = TRUE,
exp_format = "%.3f")
}
```
## Plot correlations:
```{r}
dcor <- data_behav %>%
filter(BlockStyle == 'experiment') %>%
select(-trial_num, -block_num, -c_StimN, -c_Ecc, -BlockStyle, -Hit, -CorrRej, -FalseAlarm, -Miss) %>%
group_by(ppid) %>%
summarise_all(.funs = c(mean = ~mean(., na.rm=TRUE))) %>%
ungroup() %>%
select(-ppid)
Mcor <- cor(dcor, method="pearson")
Pcor <- cor.mtest(dcor, conf.level=0.95)
colnames(Mcor) = c("Mem. perf.", "RT", "CDA (our window)", "CDA (a priori window)", "PNP (our window)", "PNP (a priori window)",
"Lat. alpha pwr", "Unlat. alpha pwr (POz)", "max. decod. perf. (broadband)", "Time of ^^^", "max. decod. perf. (alpha pwr)", "Time of ^^^")
rownames(Mcor) = colnames(Mcor)
fname = file.path(path_global, 'Plots2022', 'Else', 'CorrPlot_AllMeasures.pdf')
cm = 1 / 2.54
pdf(fname, height=12 * cm, width=12 * cm)
fig = corrplot(Mcor, type = 'lower', tl.cex = 0.7) # , p.mat = Pcor$p, sig.level = 0.05)
dev.off()
```
### Rejected trials per eccentricity
```{r}
res <- func_analysis_16()
```
# Write out the full data frame:
```{r}
saveRDS(data_behav,file = file.path(path_r_data, "VME_trialdata.rds"))
variable_doc <- list()
variable_doc[["ppid"]] <-
"subject identifier"
variable_doc[["trial_num"]] <-
"trial number (1-10 & 83-92: training, 11-72: perception task, 93-812: vSTM task)"
variable_doc[["block_num"]] <-
"number of experimental block (1 & 3: training, 2: perception task, 4-13: vSTM task)"
variable_doc[["c_StimN"]] <-
"Memory Load (aka. number of memory stimuli)"
variable_doc[["c_Ecc"]] <-
"Eccentricity of the stimulus arrays (in dva)"
variable_doc[["c_ResponseCorrect"]] <-
"Correctness of response"
variable_doc[["Hit"]] <-
"Hit (Signal detection theory)"
variable_doc[["CorrRej"]] <-
"Correct rejection (Signal detection theory)"
variable_doc[["FalseAlarm"]] <-
"FalseAlarm (Signal detection theory)"
variable_doc[["Miss"]] <-
"Miss (Signal detection theory)"
variable_doc[["c_ResponseTime"]] <-
"Response time"
variable_doc[["BlockStyle"]] <-
"Type of the block (perception task or vSTM task [experiment])"
variable_doc[["CDA_amp_clustertimes"]] <-
"Mean CDA amplitude, averaged across 5 ROI electrodes and timepoints when overall CDA was sign. different from 0 (as assessed by a CBP test)"
variable_doc[["PNP_amp_clustertimes"]] <-