-
Notifications
You must be signed in to change notification settings - Fork 1
/
fribbles_exps_comparison.Rmd
4393 lines (3184 loc) · 177 KB
/
fribbles_exps_comparison.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: "Fribbles experiments 1, 2, 3, 3bis and 4"
output:
html_document:
toc: yes
pdf_document:
toc: yes
toc_depth: 3
word_document:
toc: yes
toc_depth: '3'
subtitle: Comparison of experiments
---
```{r load libraries and clean the environment, echo=FALSE, include=FALSE}
library(tidyverse);
library(ggplot2)
library(ggpubr)
library(lme4)
library(lmerTest)
library(flextable)
rm(list = ls())
```
```{r set local directory, echo=FALSE, include=FALSE}
localGitDir <- 'C:/Users/eva_v/Nexus365/Elizabeth Wonnacott - Eva_Liz_Leverhulme/leverhulmeNDL/fribbles'
```
```{r load functions from the lab repo, echo=FALSE, include=FALSE}
source(paste(localGitDir, "/tools/loadFunctionsGithub.R", sep = ""))
urlFolder <- 'https://api.github.com/repos/n400peanuts/languagelearninglab/git/trees/master?recursive=1'
urlRaw <- 'https://raw.githubusercontent.com/n400peanuts/languagelearninglab/master/tools/'
listFunctions <- c( "inverse_log_odd.R", "myCenter.R", "lizCenter.R", "getmode.R", "lizCenter2.R", "deleteRandomRows.R", "Bf.R", "adjust_intercept_model.R")
loadFunctionsGithub(urlFolder, urlRaw, listFunctions)
```
# intro
We describe three replication attempts of the Ramscar et al. (2010) paper about the effect of the order of presentation of feature-label pair association on symbolic learning. We attempted an exact replication of the original study except that the participants were recruited and tested online and a further task was added at the end of the experiment.
![](C:/Users/eva_v/Nexus365/Elizabeth Wonnacott - Eva_Liz_Leverhulme/leverhulmeNDL/fribbles/exp2/stimuli/stimuliReplication.png)
## beta estimates from Ramscar's pilot
Our predicted effect sizes for the 2AFC tasks are based on data from an unpublished study that replicates Ramscar et al., (2010) effects. For the contingency judgment task instead we use our own pilot data.
We use for further analysis of the Bayes Factor the betas extracted from the model.
These are the betas of the models ran on Ramscar’s pilot data that we specify as theory in our Bayes Factor function:
```{r, load mike_s data, include=FALSE}
read.table(paste(localGitDir, "/exp2/preReg/fmri.txt", sep = ""), header = T, stringsAsFactors = T)-> fmri
fmri<-fmri[!(fmri$subjID==1 & fmri$learning=="sx") &
!(fmri$subjID==14 & fmri$learning=="sx") &
!(fmri$subjID==22 & fmri$learning=="sx") &
!(fmri$subjID==3 & fmri$learning=="sx") &
!(fmri$subjID==4 & fmri$learning=="xs") &
!(fmri$subjID==7 & fmri$learning=="xs") &
!(fmri$subjID==10 & fmri$learning=="xs")&
!(fmri$subjID==12 & fmri$learning=="xs"),]
fmri <- fmri[(fmri$trialType!="control"),]
```
```{r, analysis of mike_s data, include=FALSE}
#center variables, we don't have NAs so I'm using lizCenter
fmri<-lizCenter(fmri, listfname = list("learning", "frequency"))
## --------------------------------- original model ------------------------------------##
fmriglmer1_V1<-glmer(acc ~ frequency.ct*learning.ct + (frequency.ct|subjID),
data = fmri,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
fmriglmer1_V2<-glmer(acc ~ frequency.ct+ frequency: learning.ct + (frequency.ct|subjID),
data = fmri,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
```
```{r, include=FALSE}
beta1 = summary(fmriglmer1_V1)$coeff["frequency.ct", "Estimate"]
beta2 = summary(fmriglmer1_V1)$coeff["learning.ct", "Estimate"]
beta3 = summary(fmriglmer1_V1)$coeff["frequency.ct:learning.ct", "Estimate"]
simple_effect = summary(fmriglmer1_V2)$coeff["frequencyl:learning.ct", "Estimate"]
simple_effecth = summary(fmriglmer1_V2)$coeff["frequencyh:learning.ct", "Estimate"]
beta1 # note this is negative, FREQUENCY
beta2 # LEARNING
beta3 #INTERACTION
simple_effect #LOW FREQUENCY
simple_effecth #HIGH FREQUENCY
```
```{r, include=FALSE}
# contingency judgment task
main_effect_type <- 53.78
main_effect_freq_by_type <- 83.618
simple_effect_learn_by_freq_high_match <- 16
simple_effect_learn_by_freq_low_match <- - 16
simple_effect_learn_by_freq_high_mismatch <- 16
simple_effect_learn_by_freq_low_mismatch <- 16
```
- frequency: $\beta$ =`r round(beta1,2)` Note that this is negative.
- learning: $\beta$ =`r round(beta2,2)`
- interaction between learning and frequency: $\beta$ =`r round(beta3,2)`
- simple effect of low frequency: $\beta$ =`r round(simple_effect,2) `
- simple effect of high frequency: $\beta$ =`r round(simple_effecth,2)`
These instead are the betas of the models ran on our pilot data of the contingency judgment task:
From our pilot data:
- main effect of type: $\beta$ =`r main_effect_type`
- main effect of frequency by type: $\beta$ =`r main_effect_freq_by_type`
- simple effect of learning by frequency - high match: $\beta$ =`r simple_effect_learn_by_freq_high_match`
- simple effect of learning by frequency - low match: $\beta$ =`r simple_effect_learn_by_freq_low_match`
- simple effect of learning by frequency - high mismatch: $\beta$ =`r simple_effect_learn_by_freq_high_mismatch`
- simple effect of learning by frequency - low mismatch: $\beta$ =`r simple_effect_learn_by_freq_low_mismatch`
## Overview of the experiments
Although all the three experiments aim to exactly replicate the original methods, they differ from the original in the way some details have been carried out online. These differences, although in principle they should not have impacted the result of the experiments, we think contributed to making the picture of the results unclear. Attempt after attempt we worked hard to minimize the differences with the original paper.
- in experiment 1 the labels that were to be associated with the objects were presented in isolation and only auditorily, rather than written on the monitor and accompanied by a carrier sentence (FL: "that was a ..X"; LF: "this is a..X"). This made the processing of the stimuli temporally different from the original, giving potentially much more time to process the labels in the visual modality. Moreover, the two tests that were to test generalization of the label-object association were administered to all subjects, instead of being randomly assigned between participants like in the original study. Given the within participants choice of testing, the number of trials making up each of the tests was also lower: 28 rather than 56. Finally, we did not implement the control condition used in the original study to filter out bad subjects, but relied on performance on an unrelated attention check to reject participants. Results were confirmed in one task, but the evidence for our hypothesis was only anecdotal (BF = 2.8) and results in one condition (the high frequency) did not resemble the original with participants performing worse. We began to suspect that our design was too far from the original.
- in experiment 2 we tried to remedy these deviations by creating an experiment that was as faithful to the original as possible. We restored the written presentation of the labels and we reintroduced the between participants testing with the correct number of trials. Finally, we reintroduced the control condition (blue bims) so that we could apply the same exclusion criterion as the original study.
The results if on the one hand in one condition (the high frequency) began to emulate the original ones, on the other hand they took a strange turn showing that all our participants could not even reach on average the chance level in the low frequency condition. These results made us think that the experiment had for some reason become extremely difficult to the point of making our participants worse. Furthermore, given the enormous individual variability, we began to suspect that the quality of our online data collection had drastically decreased. We realized that we did not check that the size of the stimuli (both labels and objects) was constant and identical for all subjects' monitors. Most likely, the combination of the difficult condition (low frequency) and the poor visibility of the stimuli, additionally presented for a very short period (about 175 ms) created a lethal combination so that participants had experienced difficulty in seeing our stimuli. These considerations made us doubting (1) the way we presented the stimuli and (2) the quality of online data collection.
- to remedy the stimuli size confound, in experiment 3 we introduced an initial calibration that allowed subjects to view stimuli at a fixed aspect ratio. No other changes to our methods have been implemented in order to isolate the problem. We do, however, switched to an hybrid method of online data collection whereby instead of releasing our experiment in the wild, we asked a bunch of university students to take our experiment. These were informed that none of them could have been traced back, and they had to run the experiment in the privacy of their homes. The results of this last experiment confirm those obtained in the original paper and the evidence in favor of these is substantial (BF = 5.74). It remained to be seen though if this last version of the experiment is the winner because of the students we recruited, who could have been particularly motivated given their course of study, or because of the control of the stimulus presentation dimension.
- Experiment 3bis is the continuation of experiment 3, but this time we opened the data collection to Prolific. There were no other changes to this experiment.
- In Experiment 4 we have merged the data from experiment 3 and 3bis.
The table below attemps to summarise the differences between the three experiments:
![](comparison_table.png)
# Ramscar et al., (2010) results
```{r, analysis of mike_s data main model, eval=FALSE}
#center variables, we don't have NAs so I'm using lizCenter
fmri<-lizCenter(fmri, listfname = list("learning", "frequency"))
## --------------------------------- original model ------------------------------------##
fmriglmer1_V1<-glmer(acc ~ frequency.ct*learning.ct + (frequency.ct|subjID),
data = fmri,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
```
```{r summary fmriglmer1_v1, echo=FALSE}
round(summary(fmriglmer1_V1)$coefficients,4)
```
```{r fmriglmer1_V2, eval=FALSE}
## --------------------------------- simple effects ------------------------------------##
fmriglmer1_V2<-glmer(acc ~ frequency.ct+ frequency: learning.ct + (frequency.ct|subjID),
data = fmri,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
```
```{r summary fmriglmer1_V2, echo=FALSE}
round(summary(fmriglmer1_V2)$coefficients,4)
```
#### plot Ramscar's data
```{r original plot sx task, include=FALSE}
sx <- aggregate(acc ~ subjID+frequency+learning,
data = fmri[fmri$testing=="sx",], mean)
sx_plot<-ggplot(sx, aes(x=frequency, y=acc, fill = learning)) +
geom_boxplot()+
geom_point(aes(fill = learning), colour = "black", shape = 21, size = 2.5,
position = position_jitterdodge(), alpha=0.6) +
geom_hline(yintercept = .25, linetype=2)+
xlab("frequency")+
ggtitle('2AFC - sx')+
coord_cartesian(ylim = c(0, 1))+
theme_classic()
```
```{r original plot xs task, include=FALSE}
xs <- aggregate(acc ~ subjID+frequency+learning,
data = fmri[fmri$testing=="xs",], mean)
xs_plot<-ggplot(xs, aes(x=frequency, y=acc, fill = learning)) +
geom_boxplot()+
geom_point(aes(fill = learning), colour = "black", shape = 21, size = 2.5,
position = position_jitterdodge(), alpha=0.6) +
geom_hline(yintercept = .25, linetype=2)+
xlab("frequency")+
ggtitle('2AFC - xs')+
coord_cartesian(ylim = c(0, 1))+
theme_classic()
```
```{r original plot xs_xs task, include=FALSE}
xs_sx <- aggregate(acc ~ subjID+frequency+learning,
data = fmri, mean)
xs_sx_plot<-ggplot(xs_sx, aes(x=frequency, y=acc, fill = learning)) +
geom_boxplot()+
geom_point(aes(fill = learning), colour = "black", shape = 21, size = 2.5,
position = position_jitterdodge(), alpha=0.6) +
geom_hline(yintercept = .25, linetype=2)+
xlab("frequency")+
ggtitle('2AFC - together')+
coord_cartesian(ylim = c(0, 1))+
theme_classic()
```
```{r, echo=FALSE, fig.width=10}
ggarrange(sx_plot, xs_plot, xs_sx_plot, ncol =3, common.legend = TRUE)
```
# Analysis template and Hypotheses
For the 2-AFC tasks we run generalised linear mixed effects models (GLMEs) including frequency and learning conditions as fixed effects, with a random intercept by participants and a random by participants slope for frequency. Before running the models, we always center the variables of interest by using a custom function ([lizCenter.R](https://n400peanuts.github.io/languagelearninglab/usefulFunctions-explained.html#lizCenter)). Note that we run separate analysis for each test, and a comprehensive analysis where we merge both tests together as in the original Ramscar's analysis.
Hypothesis for both 2-AFC tasks:
![](C:/Users/eva_v/Nexus365/Elizabeth Wonnacott - Eva_Liz_Leverhulme/leverhulmeNDL/fribbles/exp2/preReg/table1.png)
For the contingency judgment task we run a linear mixed effect model (LMER) where we specify learning-condition, match-type, and frequency condition as fixed effects. Random by participant effects are included for frequency, match type and frequency by match type.
Hypothesis for the contingency judgment task:
![](C:/Users/eva_v/Nexus365/Elizabeth Wonnacott - Eva_Liz_Leverhulme/leverhulmeNDL/fribbles/exp2/preReg/table2_correct.png)
# Results
## Experiment 1
```{r load preProcessed files exp 1, echo=FALSE, include=FALSE}
picLab_expe1 <-read.table(paste(localGitDir, "/exp1/data/generalizationPL.txt", sep = ""), header = T, stringsAsFactors = T)
labPic_expe1 <-read.table(paste(localGitDir, "/exp1/data/generalizationLP.txt", sep = ""), header = T, stringsAsFactors = T)
contingency_expe1 <-read.table(paste(localGitDir, "/exp1/data/contingencyJudgment.txt", sep = ""), header = T, stringsAsFactors = T)
randomDot <-read.table(paste(localGitDir, "/exp1/data/randomDot.txt", sep = ""), header = T, stringsAsFactors = T)
```
```{r random dot trials, echo=FALSE, include=FALSE}
unique(randomDot$subjID)-> subj;
randomDot-> randomTask
trials <- c(rep('0', 6), rep('1', 5),
rep('2', 5), rep('3', 5),
rep('4', 5))
trialstot <- as.factor(rep(trials, length(subj)))
randomTask$blocks <- trialstot
randomTask$timeout <- ifelse(randomTask$resp== -1, 1, 0)
temp<-randomTask %>%
count(timeout, subjID) %>%
filter(timeout == 1)
unique(temp$subjID)-> subjs
temp2<-randomTask[!(randomTask$subjID %in% subjs),] %>%
count(timeout, subjID, ) %>%
filter(timeout == 0)
temp2[temp2$timeout==0,]$n <- 0
rbind(temp,temp2)-> timeout
```
We calculate number of timeouts and average accuracy for the random dot task.
```{r timeout and accuracy computation, echo=FALSE, include=FALSE}
timeout <- randomTask %>%
group_by(subjID, blocks) %>%
filter(resp == -1) %>%
count()
accdistr <- randomTask[!(randomTask$resp == -1),] %>%
group_by(subjID, blocks) %>%
summarise(m = mean(acc))
```
We excluded participants that made more than 3 timeout during learning, and/or that scored less than 70% accuracy in the random dot task.
```{r bad subjects, echo=FALSE, include=FALSE}
unique(timeout[timeout$n>3,]$subjID) -> timeoutPeople #more than 3 timeouts
unique(accdistr[accdistr$m<.7,]$subjID) -> lowAccPeople
c(lowAccPeople, timeoutPeople)->badsubjs #together these are bad subjects
unique(badsubjs)-> badsubjs
```
### raw means
How many participants do we have at the net of the exclusion criterion?
```{r check number of participants, echo=FALSE, include=FALSE}
length(unique(picLab_expe1$subjID)) -> totSubjs
fl<- length(unique(picLab_expe1[picLab_expe1$learning=='FL' &
!(picLab_expe1$subjID %in% badsubjs),]$subjID))
lf<- length(unique(picLab_expe1[picLab_expe1$learning=='LF' &
!(picLab_expe1$subjID %in% badsubjs),]$subjID))
```
We have `r (fl + lf)` participants in total. `r fl` for feature-label learning, and `r lf` for label-feature learning.
We have excluded the `r ((totSubjs-(fl + lf))/totSubjs*100)`% of the total.
### 2AFC - 4 Labels task
In this task participants see one picture and have to choose the correct label among 4 candidates (dep,tob,wug,bim).
Key predictions are:
1) interaction between frequency and condition
2) FL > LF for low frequency
Secondary predictions:
3) main effect of frequency (note- will almost certainly find this, but it isn't key to our hypotheses)
4) main effect of FL> LF
```{r accuracy 2AFC 4 labels task, echo=FALSE}
picLab_expe1_clean <- picLab_expe1[!(picLab_expe1$subjID %in% badsubjs),]
facna <- addNA(picLab_expe1_clean$resp)
levels(facna) <- c(levels(picLab_expe1_clean$resp), "null")
picLab_expe1_clean$resp <- facna #recode NA into null
picLab_expe1_clean$acc <- 0;
picLab_expe1_clean[picLab_expe1_clean$category==1 & picLab_expe1_clean$resp=='dep',]$acc <- 1;
picLab_expe1_clean[picLab_expe1_clean$category==2 & picLab_expe1_clean$resp=='bim',]$acc <- 1;
picLab_expe1_clean[picLab_expe1_clean$category==3 & picLab_expe1_clean$resp=='tob',]$acc <- 1;
plyr::revalue(as.factor(picLab_expe1_clean$frequency), c("75"="high"))-> picLab_expe1_clean$frequency;
plyr::revalue(as.factor(picLab_expe1_clean$frequency), c("25"="low"))-> picLab_expe1_clean$frequency;
picLab_expe1_clean$frequency = factor(picLab_expe1_clean$frequency, levels=c('high','low'))
```
```{r piclab expe 1 main model}
picLab_expe1_clean$learning<- relevel(picLab_expe1_clean$learning, ref = "LF")
picLab_expe1_clean$frequency<- relevel(picLab_expe1_clean$frequency, ref = "high")
picLab_expe1_clean<-lizCenter(picLab_expe1_clean, listfname = list("learning", "frequency"))
repFLO<-glmer(acc ~ frequency.ct*learning.ct + (frequency.ct|subjID),
data = picLab_expe1_clean,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
output <- round(summary(repFLO)$coefficients,4)
output
```
- hypothesis D) **Higher accuracy in the high vs low frequency condition as evidenced by a main effect of frequency.**
- beta of the theory: 1.7
- beta of the current model: -1.23 (std.error = .21)
BF for frequency:
```{r piclab frequency BF expe 1, echo=FALSE}
main_effect <- output["frequency.ct", "Estimate"] #that is negative
main_se <- output["frequency.ct", "Std. Error"]
Bf(main_se, (main_effect*-1), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(beta1,2),
tail = 1)
```
- hypothesis C) **higher accuracy in the feature-label learning condition, compared to label-feature learning-condition, as evidenced by a main effect of learning-condition.**
- beta of the theory: .66
- beta of the current model: 0.5 (std.error = .21)
BF for learning:
```{r piclab learning BF expe 1, echo=FALSE}
main_effect <- output["learning.ct", "Estimate"] #that is negative
main_se <- output["learning.ct", "Std. Error"]
Bf(main_se, (main_effect), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(beta2,2),
tail = 1)
```
- hypothesis B) **A greater benefit of feature-label over label-feature for low frequency than for high frequency items, as evidenced by an interaction between frequency and learning-condition. **
- beta of the theory: 1.02
- beta of the current model: 0.129 (std.error = .41)
BF for the interaction between frequency and learning:
```{r piclab intereaction BF expe 1, echo=FALSE}
main_effect <- output["frequency.ct:learning.ct", "Estimate"] #that is negative
main_se <- output["frequency.ct:learning.ct", "Std. Error"]
Bf(main_se, (main_effect), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(beta3,2),
tail = 1)
```
MODEL 2 FOR SIMPLE EFFECTS:
```{r piclab simple effects expe 1 model}
repFLO_V2<-glmer(acc ~ frequency.ct+ frequency: learning.ct + (frequency.ct|subjID),
data = picLab_expe1_clean,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
output_simpleEffect <- round(summary(repFLO_V2)$coefficients,4)
output_simpleEffect
```
- hypothesis A.1) **Higher accuracy in the low frequency condition for the feature-label learning group compared to label-feature learning group, as evidenced by an effect of training-conditions for low-frequency test items.**
- beta of the theory: 1.17
- beta of the current model: 0.56 (std.error = .28)
BF for simple effect of learning for low frequency items:
```{r piclab simple effect of learning for low frequency items expe 1,echo=FALSE}
main_effect <- output_simpleEffect["frequencylow:learning.ct", "Estimate"] #that is negative
main_se <- output_simpleEffect["frequencylow:learning.ct", "Std. Error"]
Bf(main_se, (main_effect), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(simple_effect,2),
tail = 1)
```
- hypothesis A.2) **Related to the hypothesis above, we test also whether there is an effect of training-conditions for high-frequency test items.**
- beta of the theory: .14
- beta of the current model: 0.43 (std.error = .32)
BF for simple effect of learning for high frequency items:
```{r piclab simple effect of learning for high frequency items expe 1,echo=FALSE}
main_effect <- output_simpleEffect["frequencyhigh:learning.ct", "Estimate"] #that is negative
main_se <- output_simpleEffect["frequencyhigh:learning.ct", "Std. Error"]
Bf(main_se, (main_effect), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(simple_effecth,2),
tail = 1)
```
### 2AFC - 4 Pictures task
In this task participants had to choose the correct picture among 4 candidates for one label presented.
Key predictions are:
1) interaction between frequency and condition
2) FL > LF for low frequency
Secondary predictions:
3) main effect of frequency (note- will almost certainly find this, but it isn't key to our hypotheses)
4) main effect of FL> LF
```{r additional bad subjects}
#-----1422680 and 1432009 must be added to the black list because have very few correct trials (less than a 1/3).---#
c(badsubjs, 1422680, 1432009) -> badsubjs
```
```{r accuracy 2AFC 4 pictures task, echo=FALSE}
labPic_expe1[is.na(labPic_expe1$category),]$category <- "null" #recode NA into null
labPic_expe1$category <- as.factor(labPic_expe1$category)
labPic_expe1_clean <- labPic_expe1[!(labPic_expe1$subjID %in% badsubjs),]
labPic_expe1_clean$acc <- 0;
labPic_expe1_clean[labPic_expe1_clean$category=="1" & labPic_expe1_clean$label=='dep',]$acc <- 1;
labPic_expe1_clean[labPic_expe1_clean$category=="2" & labPic_expe1_clean$label=='bim',]$acc <- 1;
labPic_expe1_clean[labPic_expe1_clean$category=="3" & labPic_expe1_clean$label=='tob',]$acc <- 1;
plyr::revalue(as.factor(labPic_expe1_clean$frequency), c("75"="high"))-> labPic_expe1_clean$frequency;
plyr::revalue(as.factor(labPic_expe1_clean$frequency), c("25"="low"))-> labPic_expe1_clean$frequency;
labPic_expe1_clean$frequency = factor(labPic_expe1_clean$frequency, levels=c('high','low'))
```
```{r labPic expe 1 main model}
labPic_expe1_clean$learning<- relevel(labPic_expe1_clean$learning, ref = "LF")
labPic_expe1_clean$frequency<- relevel(labPic_expe1_clean$frequency, ref = "high")
labPic_expe1_clean<-lizCenter(labPic_expe1_clean, listfname = list("learning", "frequency"))
repFLO<-glmer(acc ~ frequency.ct*learning.ct + (frequency.ct|subjID),
data = labPic_expe1_clean,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
output <- round(summary(repFLO)$coefficients,4)
output
```
- hypothesis D) **Higher accuracy in the high vs low frequency condition as evidenced by a main effect of frequency.**
- beta of the theory: 1.7
- beta of the current model: -1.95 (std.error = .32)
BF for frequency:
```{r labPic frequency BF expe 1, echo=FALSE}
main_effect <- output["frequency.ct", "Estimate"] #that is negative
main_se <- output["frequency.ct", "Std. Error"]
Bf(main_se, (main_effect*-1), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(beta1,2),
tail = 1)
```
- hypothesis C) **higher accuracy in the feature-label learning condition, compared to label-feature learning-condition, as evidenced by a main effect of learning-condition.**
- beta of the theory: .66
- beta of the current model: .45 (std.error = .31)
BF for learning:
```{r labPic learning BF expe 1, echo=FALSE}
main_effect <- output["learning.ct", "Estimate"] #that is negative
main_se <- output["learning.ct", "Std. Error"]
Bf(main_se, (main_effect), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(beta2,2),
tail = 1)
```
- hypothesis B) **A greater benefit of feature-label over label-feature for low frequency than for high frequency items, as evidenced by an interaction between frequency and learning-condition.**
- beta of the theory: 1.02
- beta of the current model: -.57 (std.error = .63) #note here I use (main_effect) not (main_effect)*-1
BF for the interaction between frequency and learning:
```{r labPic intereaction BF expe 1, echo=FALSE}
main_effect <- output["frequency.ct:learning.ct", "Estimate"] #that is negative
main_se <- output["frequency.ct:learning.ct", "Std. Error"]
Bf(main_se, (main_effect),
likelihood = "normal",
modeloftheory = "normal",
modeoftheory = 0,
scaleoftheory = round(beta3,2),
tail = 1)
```
MODEL 2 FOR SIMPLE EFFECTS:
```{r labpic simple effects expe 1 model}
repFLO_V2<-glmer(acc ~ frequency.ct+ frequency: learning.ct + (frequency.ct|subjID),
data = labPic_expe1_clean,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
output_simpleEffect <- round(summary(repFLO_V2)$coefficients,4)
output_simpleEffect
```
- hypothesis A.1) **Higher accuracy in the low frequency condition for the feature-label learning group compared to label-feature learning group, as evidenced by an effect of training-conditions for low-frequency test items.**
- beta of the theory: 1.17
- beta of the current model: 0.16 (std.error = .44)
BF for simple effect of learning for low frequency items:
```{r labpic simple effect of learning for low frequency items expe 1,echo=FALSE}
main_effect <- output_simpleEffect["frequencylow:learning.ct", "Estimate"] #that is negative
main_se <- output_simpleEffect["frequencylow:learning.ct", "Std. Error"]
Bf(main_se, (main_effect), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(simple_effect,2),
tail = 1)
```
- hypothesis A.2) **Related to the hypothesis above, we test also whether there is an effect of training-conditions for high-frequency test items.**
- beta of the theory: .14
- beta of the current model: 0.74 (std.error = .44)
BF for simple effect of learning for high frequency items:
```{r labpic simple effect of learning for high frequency items expe 1,echo=FALSE}
main_effect <- output_simpleEffect["frequencyhigh:learning.ct", "Estimate"] #that is negative
main_se <- output_simpleEffect["frequencyhigh:learning.ct", "Std. Error"]
Bf(main_se, (main_effect), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(simple_effecth,2),
tail = 1)
```
### Both 2AFC tasks together
```{r merge datasets,echo=FALSE, warning=FALSE}
rbind(labPic_expe1_clean, picLab_expe1_clean)->FLO_tasks_expe1
```
```{r flo tasks expe 1 main model}
FLO_tasks_expe1$learning<- relevel(FLO_tasks_expe1$learning, ref = "LF")
FLO_tasks_expe1$frequency<- relevel(FLO_tasks_expe1$frequency, ref = "high")
FLO_tasks_expe1<-lizCenter(FLO_tasks_expe1, listfname = list("learning", "frequency"))
repFLO<-glmer(acc ~ frequency.ct*learning.ct + (frequency.ct|subjID),
data = FLO_tasks_expe1,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
output <- round(summary(repFLO)$coefficients,4)
output
```
FOCUS ON HYPOTHESES B and A.1 and A.2:
hypothesis B) A greater benefit of feature-label over label-feature for low frequency than for high frequency items, as evidenced by an interaction between frequency and learning-condition.
beta of the theory: 1.02
beta of the current model: -.22 (std.error = .46) #note that I don't change the sign in (main_effect)
BF for the interaction between frequency and learning:
BF for the interaction between learning and frequency:
```{r both 2AFC tasks together expe 1, echo=FALSE}
main_effect <- output["frequency.ct:learning.ct", "Estimate"] #that is negative
main_se <- output["frequency.ct:learning.ct", "Std. Error"]
Bf(main_se, (main_effect*-1), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(beta3,2),
tail = 1)
```
```{r simple effect (low frequency X learning) both tasks expe 1}
repFLO_V2<-glmer(acc ~ frequency.ct+ frequency: learning.ct + (frequency.ct|subjID),
data = FLO_tasks_expe1,
family="binomial",
control=glmerControl(optimizer = "bobyqa"))
output_simpleEffect <- round(summary(repFLO_V2)$coefficients,4)
output_simpleEffect
```
hypothesis A.1) **Higher accuracy in the low frequency condition for the feature-label learning group compared to label-feature learning group, as evidenced by an effect of training-conditions for low-frequency test items**.
beta of the theory: 1.17
beta of the current model: .36 (std.error = .33)
BF for simple effect of learning for low frequency items:
```{r simple effect of learning for low frequency items both tasks expe 1, echo=FALSE}
main_effect <- output_simpleEffect["frequencylow:learning.ct", "Estimate"] #that is negative
main_se <- output_simpleEffect["frequencylow:learning.ct", "Std. Error"]
Bf(main_se, (main_effect*-1), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(simple_effect,2),
tail = 1)
```
hypothesis A.2) **Related to the hypothesis above, we test also whether there is an effect of training-conditions for high-frequency test items.**.
beta of the theory: .14
beta of the current model: .58 (std.error = .33)
BF for simple effect of learning for high frequency items:
```{r simple effect of learning for high frequency items both tasks expe 1, echo=FALSE}
main_effect <- output_simpleEffect["frequencyhigh:learning.ct", "Estimate"] #that is negative
main_se <- output_simpleEffect["frequencyhigh:learning.ct", "Std. Error"]
Bf(main_se, (main_effect*-1), #main effect - note that if you want to compute BF for frequency that is negative
likelihood = "normal", #you need to have (maineffect*-1) to revert it to positive otherwise the function
modeloftheory = "normal", #throws an error
modeoftheory = 0,
scaleoftheory = round(simple_effecth,2),
tail = 1)
```
### contingency task
For this task we are interested in just the match + mismatch_type1 data, and the following predictions:
The predictions are:
1) high: match: higher positive weight in LF (+ve coefficient) [LARGER EFFECT]
2) low match: higher positive weight in FL (-ve coeffficient) [SMALLER EFFECT]
3) high mismatch type 1: FL larger negative weight than LF (+ve coefficient)
4) low mismatch type 1: FL larger negative weight, LF positive (+ve coefficient) [LARGER EFFECT]
All of these are predicted from the computational model - however it is most likley that we will see the effects in (1) and (4) since these are largest.
```{r clean contingency data, echo=FALSE}
contingency_expe1_clean <- contingency_expe1[!(contingency_expe1$subjID %in% badsubjs),]
```
```{r acc calculation contingency_expe1_clean expe 1, echo=FALSE}
contingency_expe1_clean$acc <- 0;
contingency_expe1_clean[contingency_expe1_clean$category==1 & contingency_expe1_clean$label=='dep',]$acc <- 1;
contingency_expe1_clean[contingency_expe1_clean$category==2 & contingency_expe1_clean$label=='bim',]$acc <- 1;
contingency_expe1_clean[contingency_expe1_clean$category==3 & contingency_expe1_clean$label=='tob',]$acc <- 1;
plyr::revalue(as.factor(contingency_expe1_clean$frequency), c("25"="low"))-> contingency_expe1_clean$frequency;
plyr::revalue(as.factor(contingency_expe1_clean$frequency), c("75"="high"))-> contingency_expe1_clean$frequency;
contingency_expe1_clean <- contingency_expe1_clean[!is.na(contingency_expe1_clean$resp),]
```
```{r high freq schema contingency expe1, echo=FALSE}
#-----For each learning condition, look at their average score for each of the 6 combinations of frequency and type---#
highFreqFL<-data.frame(
learning = rep("FL",9),
frequency = rep("high",9),
type = c(rep("match",3),
rep("mismatch-type1",3),
rep("mismatch-type2",3)),
label = c("dep_cat1", "bim_cat2", "tob_cat3"),
fribble = c(1.1,2.1,3.1,
3.1,1.1,2.1,
2.1,3.1,1.1),
fribbleCategory = c("cat1", "cat2", "cat3", #match
"cat3", "cat1", "cat2", #mis-type1
"cat2", "cat3", "cat1")) #mis-type2
highFreqLF<-data.frame(
learning = rep("LF",9),
frequency = rep("high",9),
type = c(rep("match",3),
rep("mismatch-type1",3),
rep("mismatch-type2",3)),
label = c("dep_cat1", "bim_cat2", "tob_cat3"),
fribble = c(1.1,2.1,3.1,
3.1,1.1,2.1,
2.1,3.1,1.1),
fribbleCategory = c("cat1", "cat2", "cat3", #match
"cat3", "cat1", "cat2", #mis-type1
"cat2", "cat3", "cat1")) #mis-type2
rbind(highFreqFL, highFreqLF)-> highFreq
rm(highFreqFL, highFreqLF)
```
```{r high frequency contingency expe1, echo=FALSE}
#Okay, let's fill each row:
resp <- c(
#-----------------------------------------FL LEARNING
# ROW 1 #MATCH
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==1 ,]$resp),
# ROW 2
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==2 ,]$resp),
# ROW 3
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==3 ,]$resp),
# ROW 4 #MISMATCH -TYPE1
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==3 ,]$resp),
# ROW 5
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==1 ,]$resp),
# ROW 6
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==2 &
!(contingency_expe1_clean$subjID %in% badsubjs),]$resp),
# ROW 7 #MISMATCH -TYPE2
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==2 ,]$resp),
# ROW 8
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==3 &
!(contingency_expe1_clean$subjID %in% badsubjs),]$resp),
# ROW 9
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==1 ,]$resp),
#----------------------------------------------- LF LEARNING
# ROW 1 #MATCH
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==1 ,]$resp),
# ROW 2
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==2 ,]$resp),
# ROW 3
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==3 ,]$resp),
# ROW 4 #MISMATCH -TYPE1
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==3 ,]$resp),
# ROW 5
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==1 ,]$resp),
# ROW 6
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==2 ,]$resp),
# ROW 7 #MISMATCH -TYPE2
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==2 ,]$resp),
# ROW 8
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==3 ,]$resp),
# ROW 9
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="LF" &
contingency_expe1_clean$frequency=="high" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==1 ,]$resp)
)
highFreq$resp <- resp
```
```{r low freq schema contingency expe 1, echo=FALSE}
lowFreqFL<-data.frame(
learning = rep("FL",9),
frequency = rep("low",9),
type = c(rep("match",3),
rep("mismatch-type1",3),
rep("mismatch-type2",3)),
label = c("dep_cat1", "bim_cat2", "tob_cat3"),
fribble = c(1.2,2.2,3.2,
2.2,3.2,1.2,
3.2,1.2,2.2),
fribbleCategory = c("cat1", "cat2", "cat3", #match
"cat2", "cat3", "cat1", #mis-type1
"cat3", "cat1", "cat2")) #mis-type2
lowFreqLF<-data.frame(
learning = rep("LF",9),
frequency = rep("low",9),
type = c(rep("match",3),
rep("mismatch-type1",3),
rep("mismatch-type2",3)),
label = c("dep_cat1", "bim_cat2", "tob_cat3"),
fribble = c(1.2,2.2,3.2,
2.2,3.2,1.2,
3.2,1.2,2.2),
fribbleCategory = c("cat1", "cat2", "cat3", #match
"cat2", "cat3", "cat1", #mis-type1
"cat3", "cat1", "cat2")) #mis-type2
lowFreq<- rbind(lowFreqFL, lowFreqLF)
rm(lowFreqFL, lowFreqLF)
```
```{r low frequency contingency expe 1, echo=FALSE}
resp <- c(
#-----------------------------------------FL LEARNING
# ROW 1 #MATCH
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="low" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==1 ,]$resp),
# ROW 2
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="low" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==2 ,]$resp),
# ROW 3
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="low" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==3 ,]$resp),
# ROW 4 #MISMATCH -TYPE1
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="low" &
contingency_expe1_clean$label=='dep' &
contingency_expe1_clean$category==2,]$resp),
# ROW 5
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="low" &
contingency_expe1_clean$label=='bim' &
contingency_expe1_clean$category==3 ,]$resp),
# ROW 6
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="low" &
contingency_expe1_clean$label=='tob' &
contingency_expe1_clean$category==1 ,]$resp),
# ROW 7 #MISMATCH -TYPE2
mean(contingency_expe1_clean[contingency_expe1_clean$learning=="FL" &
contingency_expe1_clean$frequency=="low" &
contingency_expe1_clean$label=='dep' &