forked from freyawatkins/freyawatkins.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewpoint_model_analysis.Rmd
961 lines (878 loc) · 44.5 KB
/
viewpoint_model_analysis.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
---
title: "BSL Angle Processing analysis"
author: "Freya Watkins & Bodo Winter"
date: "2019-06-03"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Mixed model analysis:
Load packages:
```{r setup_load_packages}
setwd("~/R/Viewpoint")
library(tidyverse)
library(car)
library(lme4)
library(afex)
library(directlabels)
library(emmeans)
```
Read in the file, convert to tibble:
```{r read_in_file}
vp <- read.delim("2019-06-04 Viewpoint.txt")
vp <- as_tibble(vp)
head(vp)
vp$Angle <- as.factor(vp$Angle)
```
# Overview for methods section:
Check number of subjects and how many data points per subjects:
```{r check_subs}
length(unique(vp$Subject))
summary(vp$Subject)
```
Number of subjects per group; and then by L1 vs L2:
```{r check_groups}
table(vp$Group) / 490
```
What's the breakdown in terms of sign type?
```{r sign_types}
vpnoprac <- filter(vp, PrimeTarget != 'practice')
table(vpnoprac$SignType) / 90
```
What's the breakdown in terms of noun class?
```{r noun_classes}
table(vpnoprac$NounClass) / 90
```
Coded for noun class (body-anchored as well as other categories, following Pfau & Steinbach, 2005 - haven't found anything for BSL yet)
Check signs by degree of change:
```{r sign_by_degree_change}
table(vp$Sign, vp$AngleChange)
```
Most items are balanced for degree of change. Some items are imbalanced due to the accidental inclusion of pairs with a 135 degree rotation (i.e. 90-45 on opposite sides) Other imbalances are due to different experiment versions not being perfectly counterbalanced across participants
Check sign by difficulty condition:
```{r sign_by_condition}
table(vp$Sign, vp$Difficulty)
```
Some items appear only in easier, only in harder, some appear in both. Only some appear in opposite, but all appear in same. This is due to the design aiming to balance for 'degree of change between prime/target' rather than 'Difficulty'.
Now we'll log-transform the RT variable for later analysis:
```{r log_transform_RT}
vp <- mutate(vp, Log10RT = log10(RT))
```
The column "Priming" shows RT2-RT1; "LogDiff" shows LogRT2-LogRT1; "PercentFaster" shows how much faster RT2 was than RT1 as a percentage.
Number of unique signs:
```{r check_signs}
length(unique(vp$Sign))
```
Check number of data points per sign:
```{r check_signs_numbers}
table(vp$Sign)
```
Which signs don't have 90 data points per subject?
```{r lower_item_nums}
which(table(vp$Sign) != 90)
```
These are the 10 practice trials.
# Exclusions:
1. Discard practice trials
```{r no_practice}
vp <- filter(vp,
PrimeTarget != 'practice')
```
2. Exclude items with low accuracy (below 70% overall)
Calculate accuracy per item:
```{r show_item_acc}
item_acc <- vp %>% group_by(Sign) %>%
summarize(ACC = mean(ACC))
print(item_acc)
```
13 items had below 70% accuracy (5.4% of 240 items)
Exclude those items from further analysis:
```{r no_low_acc_items}
vp <- filter(vp,
ExclItem != 1)
```
Not sure about leaving this in or not? Perhaps a lower threshold than 70%? Some items have really low average acc e.g. 12%...
3. Exclude very fast (<500ms) or very slow (>10000ms) trials
```{r no_fast_slow_trials}
vp <- filter(vp,
ExclSlowFast != 1)
```
10 trials out of 22,050 (0.05%) were excluded from further analysis.
# Creating tibbles
For the prime accuracy analysis, we should reduce the vp tibble to prime trials only:
```{r acc_prime_tibble}
vpAccPrimes <- filter(vp, PrimeTarget == 'prime')
summary(vpAccPrimes$PrimeTarget)
```
The prime accuracy analysis will be conducted on 10,800 trials.
For the prime RT analysis, we'll additionally exclude incorrect responses:
```{r RT_prime_tibble}
vpRTPrimes <- filter(vpAccPrimes, ExclIncorrect != 1)
summary(vpRTPrimes$PrimeTarget)
```
The prime RT analysis will be conducted on 9685 trials
For the Accuracy difference analysis, we'll exclude prime-target pairs that do not neatly fit into the three difficulty categories. Firstly those pairs with a 135 degree rotation (e.g. 90L-45R; 54 pairs total = 0.53% of data); as well as pairs with a 'opposite' rotation (e.g. 45L-45R; 1383 pairs total = 13.54% of data)
```{r acc_target_tibble}
vpAccTargets <- filter(vp, Excl135Deg != 1) %>% filter(ExclOpposite !=1) %>%
filter(PrimeTarget == 'target')
vpAccTargets$Difficulty <- factor(vpAccTargets$Difficulty)
vpAccTargets$AngleChange <- factor(vpAccTargets$AngleChange)
summary(vpAccTargets$PrimeTarget)
```
The accuracy difference analysis will be conducted on 9362 prime-target pairs
For the RT difference analysis, we'll additionally exclude incorrect target trials (and their pairs), as well as the pairs of the 10 slow/fast trials. This is because we cannot calculate difference scores when one trial of a prime-target pair has been excluded, meaning its pair must be excluded too.
```{r RT_target_tibble}
vpRTTargets <- filter(vpAccTargets, ExclIncorrect != 1) %>%
filter(ExclPairIncorr != 1) %>% filter(ExclPairSlow != 1)
vpRTTargets$Difficulty <- factor(vpRTTargets$Difficulty)
vpRTTargets$AngleChange <- factor(vpRTTargets$AngleChange)
summary(vpRTTargets$PrimeTarget)
```
The accuracy difference analysis will be conducted on 7987 prime-target pairs
## Descriptive statistics:
Averages per Group, Sign Type, Noun Class and Priming condition for accuracy:
```{r overall_averages}
vp %>% group_by(Group) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccPrimes %>% group_by(Group) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccTargets %>% group_by(Group) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccPrimes %>% group_by(SignType) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccTargets %>% group_by(SignType) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccPrimes %>% group_by(NounClass) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccTargets %>% group_by(NounClass) %>%
summarize(ErrorRate = mean(ErrorRate))
vp %>% group_by(PrimeTarget, AngleLR) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccPrimes %>% group_by(AngleLR) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccTargets %>% group_by(Difficulty) %>%
summarize(ErrorRate = mean(ErrorRate))
vpAccPrimes %>% group_by(Subject) %>%
summarize(ErrorRate = mean(ErrorRate))
```
- Fluent signers clearly make fewer errors than intermediate M2L2 signers
- Prime/target breakdown: group differences more pronounced for prime trials; M2-L2 groups improve 2-3% for Targets.
- 2HA signs least accurately comprehended. Biggest improvement at target for 2HS signs
- Midsagittal signs have fewer errors than body-anchored or lateral signs at Prime. Body-anchored signs still have high error rates at target
- Overall, slightly higher accuracy for target vs prime (learning effect?)
- A clear progression from 0 degree angle having the fewest errors (~6%), to 45 degree angles (~9%), to 90 degree angles having the most errors (~15%) for Prime trials
- For target trials, similar error rates across Difficulty conditions.
Averages per Group, Sign Type, Noun Class and Priming condition for RT:
```{r overall_averages_RT}
vpRTPrimes %>% group_by(Group, AngleLR) %>%
summarize(RT = mean(RT))
vpRTTargets %>% group_by(Group) %>%
summarize(RT = mean(RT))
vpRTPrimes %>% group_by(SignType,AngleLR) %>%
summarize(RT = mean(RT))
vpRTTargets %>% group_by(SignType) %>%
summarize(RT = mean(RT))
vpRTPrimes %>% group_by(NounClass) %>%
summarize(RT = mean(RT))
vpRTTargets %>% group_by(NounClass) %>%
summarize(RT = mean(RT))
vp %>% filter(ExclIncorrect != 1) %>% group_by(PrimeTarget) %>%
summarize(RT = mean(RT))
vpRTPrimes %>% group_by(AngleLR) %>%
summarize(RT = mean(RT))
vpRTTargets %>% group_by(Difficulty) %>%
summarize(RT = mean(RT))
vpRTTargets %>% group_by(Difficulty, Group) %>%
summarize(Priming = mean(Priming))
vpRTTargets %>% group_by(Difficulty) %>%
summarize(PercentFaster = mean(PercentFaster))
```
- L2 intermediate signers about 480ms slower than L1 Deaf signers to Primes
- Gap between these groups closes to 365ms at target
- One-handed signs fastest, 2ha signs lag behind 2hs signs, same at Prime & Target
- No clear effect of noun class on RTs at prime or target
- Definite overall priming difference with targets around 150ms faster.
- 0 angle clearly fastest and both 90 angles slowest, but 45L much faster than 45R! (RH closest here?)
- Not obvious effect of difficulty condition on target RT alone
- But looking at Priming (RT2-RT1), obviously more priming in easier (229ms) & same conditions (194ms) than harder condition (71ms)
- Also clear from proportional transformation (% faster) 15% faster for easier, 14% for same, just 6% faster in harder condition.
Is there something going on between Sign Type and Angle?
```{r signtype_by_angle}
vpAccPrimes %>% group_by(SignType, AngleLR) %>%
summarize(ErrorRate = mean(ErrorRate))
vpRTPrimes %>% group_by(SignType, AngleLR) %>%
summarize(RT = mean(RT))
```
Less variation in error rates by angle to 1h signs. Error rate is lowest to 2hs at 0 and 45L. However when one hand may begin to occlude the other, particularly the right hand, error rate increases (i.e. at 90R for 2hs and 2ha). Interestingly 45L much better than 45R for 2hs signs.
For RT, again there is less variation cause by angle for 1H signs. 2ha signs are surprisingly slow at 0 - here 45L is the fastest. Clearest angle effect on 2hs signs - they start fastest of all at 0 but see huge slowdowns as angle increases likely due to occlusion. 45L faster than 45R in 1h and 2ha. 90R much slower than 90L for 2hs signs, i.e when the entire dominant right-hand is occluded.
What about between Noun Class and Angle?
```{r nounclass _by_angle}
vpAccPrimes %>% group_by(NounClass, AngleLR) %>%
summarize(ErrorRate = mean(ErrorRate))
vpRTPrimes %>% group_by(NounClass, AngleLR) %>%
summarize(RT = mean(RT))
```
Patterns for noun class are less clear. Largest variation in error rates for body-anchored signs and in RT for midsagittal signs. Some surprisng results - e.g. more errors and slower RTs for lateral signs at 90L where they should be clearest, than at 90R where they should be occluded.
## Plots
Accuracy plots:
```{r accuracy_plots}
vpAccPrimes %>% group_by(AngleLR, Group) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = ErrorRate, group = Group, colour = Group)) +
coord_cartesian(ylim = c(0,0.20)) +
geom_dl(aes(x = AngleLR, y = ErrorRate, label = Group),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 18) +
theme(legend.position = "none") +
ggtitle('ErrorRate to Primes by Angle & Group') + xlab('Angle')
vpAccPrimes %>% group_by(AngleLR, L1L2) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = ErrorRate, group = L1L2, colour = L1L2)) +
coord_cartesian(ylim = c(0,0.20)) +
geom_dl(aes(x = AngleLR, y = ErrorRate, label = L1L2),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 18) +
theme(legend.position = "none") +
ggtitle('ErrorRate to Primes by Angle & Group') + xlab('Angle')
vpAccPrimes %>% group_by(AngleLR, SignType) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = ErrorRate, group = SignType, colour = SignType)) +
coord_cartesian(ylim = c(0,0.15)) +
geom_dl(aes(x = AngleLR, y = ErrorRate, label = SignType),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('ErrorRate to Primes by Angle & Sign Type') + xlab('Angle')
vpAccPrimes %>% filter(IconCat != 'na') %>% group_by(AngleLR, IconCat) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")), y = ErrorRate, group = IconCat, colour = IconCat)) +
coord_cartesian(ylim = c(0,0.15)) +
geom_dl(aes(x = AngleLR, y = ErrorRate, label = IconCat),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('ErrorRate to Primes by Angle & Iconicity Category') + xlab('Iconicity Category')
vpAccPrimes %>% filter(IconRating != 0) %>% group_by(AngleLR, IconRating) %>%
summarize(ErrorRate = mean(ErrorRate)) %>% ggplot +
geom_point(aes(x=IconRating, y=ErrorRate, color=AngleLR, shape=AngleLR)) +
geom_smooth(aes(x=IconRating, y=ErrorRate, color=AngleLR, shape=AngleLR), method=lm,se=FALSE) +coord_cartesian(ylim = c(0,0.20)) +
ggtitle('ErrorRate by Angle & Iconicity Rating')
vpAccPrimes %>% group_by(AngleLR, NounClass) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")), y = ErrorRate, group = NounClass, colour = NounClass)) +
coord_cartesian(ylim = c(0,0.20)) +
geom_dl(aes(x = AngleLR, y = ErrorRate, label = NounClass),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 18) +
theme(legend.position = "none") +
ggtitle('ErrorRate to Primes by Angle & Noun Class')+ xlab('Angle')
vpAccTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>% group_by(Difficulty, Group) %>%
summarize(AccChange = mean(AccChange)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")), y = AccChange, group = Group, colour = Group)) +
coord_cartesian(ylim = c(-0.06,0.06)) +
geom_dl(aes(x = Difficulty, y = AccChange, label = Group),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) + theme(legend.position = "none") +
ggtitle('Change in Accuracy at Target by Difficulty & Group') + xlab('Difficulty')
vpAccTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>% group_by(Difficulty, SignType) %>%
summarize(AccChange = mean(AccChange)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")), y = AccChange, group = SignType, colour = SignType)) +
coord_cartesian(ylim = c(-0.06,0.06)) +
geom_dl(aes(x = Difficulty, y = AccChange, label = SignType),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) + theme(legend.position = "none") +
ggtitle('Change in Accuracy at Target by Difficulty & Sign Type') + xlab('Difficulty')
vpAccTargets %>% filter(Difficulty != 'exclude', Difficulty != 'opposite', IconCat != 'na') %>% group_by(Difficulty, IconCat) %>%
summarize(AccChange = mean(AccChange)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")), y = AccChange, group = IconCat, colour = IconCat)) +
coord_cartesian(ylim = c(-0.06,0.06)) +
geom_dl(aes(x = Difficulty, y = AccChange, label = IconCat),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) + theme(legend.position = "none") +
ggtitle('Change in Accuracy at Target by Difficulty & Iconicity Category') + xlab('Difficulty')
vpAccTargets %>% filter(IconRating != 0, Difficulty != 'exclude', Difficulty != 'opposite') %>% group_by(Difficulty, IconRating) %>% summarize(AccChange = mean(AccChange)) %>% ggplot + geom_point(aes(x=IconRating, y=AccChange, color=Difficulty, shape=Difficulty)) + geom_smooth(aes(x=IconRating, y=AccChange, color=Difficulty, shape=Difficulty), method=lm,se=FALSE) +coord_cartesian(ylim = c(-0.06,0.06)) +
ggtitle('Change in Accuracy at Target by Difficulty & Iconicity Rating')
vpAccTargets %>% filter(Difficulty != 'exclude', Difficulty != 'opposite') %>% group_by(Difficulty, NounClass) %>% summarize(AccChange = mean(AccChange)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")), y = AccChange, group = NounClass, colour = NounClass)) +
coord_cartesian(ylim = c(-0.06,0.06)) +
geom_dl(aes(x = Difficulty, y = AccChange, label = NounClass),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) + theme(legend.position = "none") +
ggtitle('Change in Accuracy at Target by Difficulty & Noun Class') + xlab('Difficulty')
```
Could only get IconRatings plot code to work as a scatter plot. Not sure if IconRating should be coded as ordered? Interesting that errors increase with iconicity for 90L (and slightly for 45L) whereas other angles show decrease in errors as iconicity increases. But not sure of the how strong these trends are...
Plot RTs the same way:
```{r RT_plots}
vpRTPrimes %>% group_by(AngleLR, Group) %>%
summarize(RT = mean(RT)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = RT, group = Group,
colour = Group)) +
coord_cartesian(ylim = c(1500,2300)) +
geom_dl(aes(x = AngleLR, y = RT, label = Group),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('RT to Primes by Angle & Group') + xlab('Angle')
vpRTPrimes %>% group_by(AngleLR, SignType) %>%
summarize(RT = mean(RT)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = RT, group = SignType,
colour = SignType)) +
coord_cartesian(ylim = c(1500,2300)) +
geom_dl(aes(x = AngleLR, y = RT, label = SignType),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('RT to Primes by Angle & Sign Type') + xlab('Angle')
vpRTPrimes %>% filter(IconCat != 'na') %>% group_by(AngleLR, IconCat) %>%
summarize(RT = mean(RT)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level =
c("90L", "45L", "0", "45R", "90R")),
y = RT, group = IconCat, colour = IconCat)) +
coord_cartesian(ylim = c(1500,2300)) +
geom_dl(aes(x = AngleLR, y = RT, label = IconCat),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('RT to Primes by Angle & Iconicity') + xlab('Iconicity Category')
vpRTPrimes %>% filter(IconRating != 0) %>% group_by(AngleLR, IconRating) %>%
summarize(RT = mean(RT)) %>% ggplot +
geom_point(aes(x=IconRating, y=RT, color=AngleLR, shape=AngleLR)) +
geom_smooth(aes(x=IconRating, y=RT, color=AngleLR, shape=AngleLR), method=lm,se=FALSE) + coord_cartesian(ylim = c(1700,2100)) +
ggtitle('RT to Primes by Angle & Iconicity Rating')
vpRTPrimes %>% group_by(AngleLR, NounClass) %>%
summarize(RT = mean(RT)) %>%
ggplot + geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = RT, group = NounClass,
colour = NounClass)) +
coord_cartesian(ylim = c(1500,2300)) +
geom_dl(aes(x = AngleLR, y = RT, label = NounClass),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('RT to Primes by Angle & Noun Class') + xlab('Angle')
vp %>% filter(ExclIncorrect != 1) %>% group_by(AngleLR, PrimeTarget) %>%
summarize(RT = mean(RT)) %>% ggplot +
geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = RT, group = PrimeTarget,
colour = PrimeTarget)) +
coord_cartesian(ylim = c(1700,2100)) +
geom_dl(aes(x = AngleLR, y = RT, label = PrimeTarget),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 18) +
theme(legend.position = "none") +
ggtitle('RT to Primes/Targets by Angle') + xlab('Angle')
vpRTTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>% group_by(Difficulty, Group) %>%
summarize(Priming = mean(Priming)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = Priming, group = Group, colour = Group)) +
coord_cartesian(ylim = c(0,300)) +
geom_dl(aes(x = Difficulty, y = Priming, label = Group),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('Priming at Target by Difficulty & Group') + xlab('Difficulty')
vpRTTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>% group_by(Difficulty, SignType) %>%
summarize(Priming = mean(Priming)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = Priming, group = SignType, colour = SignType)) +
coord_cartesian(ylim = c(0,300)) +
geom_dl(aes(x = Difficulty, y = Priming, label = SignType),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('Priming at Target by Difficulty & SignType') + xlab('Difficulty')
vpRTTargets %>% filter(Difficulty != 'exclude', Difficulty != 'opposite', IconCat != 'na') %>%
group_by(Difficulty, IconCat) %>% summarize(Priming = mean(Priming)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")), y = Priming, group = IconCat, colour = IconCat)) +
coord_cartesian(ylim = c(0,300)) +
geom_dl(aes(x = Difficulty, y = Priming, label = IconCat),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('Priming at Target by Difficulty & Iconicity Category') + xlab('Difficulty')
vpRTTargets %>% filter(IconRating != 0, Difficulty != 'exclude', Difficulty != 'opposite') %>% group_by(Difficulty, IconRating) %>% summarize(Priming = mean(Priming)) %>% ggplot + geom_point(aes(x=IconRating, y=Priming, color=Difficulty, shape=Difficulty)) +
geom_smooth(aes(x=IconRating, y=Priming, color=Difficulty, shape=Difficulty), method=lm,se=FALSE) + coord_cartesian(ylim = c(0,300)) +
ggtitle('Priming at Target by Difficulty & Iconicity Rating')
vpRTTargets %>% filter(Difficulty != 'exclude', Difficulty != 'opposite') %>%
group_by(Difficulty, NounClass) %>% summarize(Priming = mean(Priming)) %>%
ggplot + geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")), y = Priming, group = NounClass, colour = NounClass)) +
coord_cartesian(ylim = c(0,300)) +
geom_dl(aes(x = Difficulty, y = Priming, label = NounClass),
method = list(dl.combine("last.points"), cex = 0.8)) +
theme_minimal(base_size = 16) +
theme(legend.position = "none") +
ggtitle('Priming at Target by Difficulty & Noun Class') + xlab('Difficulty')
```
Seems to be less going on with iconicity here, but interesting again that RT increase with iconicity for 45L only... Also not sure why low iconicity = more priming in Easier & Harder conditions only..?
Accuracy averages broken up by group with facet wraps:
```{r accuracy_group}
vpAccPrimes %>% group_by(AngleLR, Group) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = ErrorRate, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(0, 0.20)) +
theme_minimal(base_size = 18) +
ggtitle('Error Rate to Primes by Angle') + xlab('Angle')
vpAccPrimes %>% group_by(SignType, Group) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot(aes(x = SignType, y = ErrorRate, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(0, 0.15)) +
theme_minimal(base_size = 22) +
ggtitle('ErrorRate to Primes by Sign Type')
vpAccPrimes %>% filter(IconCat != 'na') %>% group_by(IconCat, Group) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot(aes(x = factor(IconCat, level = c("low", "mid", "high")),
y = ErrorRate, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(0, 0.15)) +
theme_minimal(base_size = 22) +
ggtitle('ErrorRate to Primes by Iconicity')+ xlab('Iconicity')
vpAccPrimes %>% group_by(NounClass , Group) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot(aes(x = NounClass, y = ErrorRate, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(0, 0.15)) +
theme_minimal(base_size = 18) +
ggtitle('ErrorRate to Primes by Noun Class & Group')
vpAccTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>%
group_by(Difficulty, Group) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot(aes(factor(Difficulty, level = c("easier", "same", "harder")),
y = ErrorRate, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(0, 0.15)) +
theme_minimal(base_size = 18) +
ggtitle('Error Rate to Targets by Difficulty') + xlab('Difficulty')
vpAccTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>%
group_by(Difficulty, Group) %>%
summarize(AccChange = mean(AccChange)) %>%
ggplot(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = AccChange, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(-.06, .06)) +
theme_minimal(base_size = 18) +
ggtitle('Change in Accuracy by Difficulty') + xlab('Difficulty')
```
RT averages broken up by group with facet wraps:
```{r RT_group}
vpRTPrimes %>% group_by(AngleLR, Group) %>%
summarize(RT = mean(RT)) %>%
ggplot(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = RT, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(1500, 2300)) +
theme_minimal(base_size = 18) +
ggtitle('RT to Primes by Angle') + xlab('Angle')
vpRTPrimes %>% group_by(SignType, Group) %>%
summarize(RT = mean(RT)) %>%
ggplot(aes(x = SignType, y = RT, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(1500, 2300)) +
theme_minimal(base_size = 22) +
ggtitle('RT to Primes by Sign Type')
vpRTPrimes %>% filter(IconCat != 'na') %>% group_by(IconCat, Group) %>%
summarize(RT = mean(RT)) %>%
ggplot(aes(x = factor(IconCat, level = c("low", "mid", "high")),
y = RT, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(1500, 2300)) +
theme_minimal(base_size = 22) +
ggtitle('RT to Primes by Iconicity')+ xlab('Iconicity')
vpRTPrimes %>% group_by(NounClass, Group) %>%
summarize(RT = mean(RT)) %>%
ggplot(aes(x = NounClass, y = RT, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(1500, 2300)) +
theme_minimal(base_size = 18) +
ggtitle('RT to Primes by Noun Class')
vpRTTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>%
group_by(Difficulty, Group) %>%
summarize(RT = mean(RT)) %>%
ggplot(aes(factor(Difficulty, level = c("easier", "same", "harder")),
y = RT, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(1500, 2100)) +
theme_minimal(base_size = 18) +
ggtitle('RT to Targets by Difficulty') + xlab('Difficulty')
vpRTTargets %>% filter(Difficulty != 'exclude',
Difficulty != 'opposite') %>%
group_by(Difficulty, Group) %>%
summarize(Priming = mean(Priming)) %>%
ggplot(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = Priming, fill = Group)) +
geom_bar(stat = 'identity', position = position_dodge()) +
coord_cartesian(ylim = c(0, 300)) +
theme_minimal(base_size = 18) +
ggtitle('Priming at Targets by Difficulty & Group') + xlab('Difficulty')
```
# By-subject plots
Create by-subject plots:
```{r subject_plots}
vpAccPrimes %>% group_by(AngleLR, Group, Subject) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = ErrorRate, group=Subject, colour = Group)) +
geom_point(size = 3, alpha = 0.5) +
geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = ErrorRate, group=Subject, colour = Group)) +
theme_minimal(base_size = 16) +
ggtitle('ErrorRate by Angle to Primes') + xlab('Angle')
vpAccPrimes %>% group_by(Angle, Group, Subject) %>%
summarize(ErrorRate = mean(ErrorRate)) %>%
ggplot(aes(x = Angle, y = ErrorRate, group=Subject, colour = Group)) +
geom_point(size = 3, alpha = 0.5) +
geom_line(aes(x = Angle, y = ErrorRate, group=Subject, colour = Group)) + geom_dl(aes(x = Angle, y = ErrorRate, label = Subject),
method = list(dl.combine("last.points"), cex = 0.8)) +
coord_cartesian(xlim = c(0, 100)) +
theme_minimal(base_size = 16) +
ggtitle('ErrorRate by Angle to Primes') + xlab('Angle')
vpRTPrimes %>% group_by(AngleLR, Group, Subject) %>%
summarize(RT = mean(RT)) %>%
ggplot(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = RT, group=Subject, colour = Group)) +
geom_point(size = 3, alpha = 0.5) +
geom_line(aes(x = factor(AngleLR, level = c("90L", "45L", "0", "45R", "90R")),
y = RT, group=Subject, colour = Group)) +
theme_minimal(base_size = 16) +
ggtitle('RT by Angle to Primes') + xlab('Angle')
vpRTPrimes %>% group_by(Angle, Group, Subject) %>%
summarize(RT = mean(RT)) %>% ggplot(aes(x = Angle, y = RT, group=Subject, colour = Group)) + geom_point(size = 3, alpha = 0.5) +
geom_line(aes(x = Angle, y = RT, group=Subject, colour = Group)) + geom_dl(aes(x = Angle, y = RT, label = Subject),
method = list(dl.combine("last.points"), cex = 0.8)) +
coord_cartesian(xlim = c(0, 100)) + theme_minimal(base_size = 16) + ggtitle('RT by Angle to Primes') + xlab('Angle')
vpAccTargets %>% group_by(Difficulty, Group, Subject) %>%
summarize(AccChange = mean(AccChange)) %>%
ggplot(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = AccChange, group=Subject, colour = Group)) +
coord_cartesian(ylim = c(-0.2, 0.2)) +
geom_point(size = 3, alpha = 0.5) +
geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = AccChange, group=Subject, colour = Group)) +
theme_minimal(base_size = 18) +
ggtitle('Change in Accuracy by Angle (Acc1-Acc2)') + xlab('Difficulty')
vpRTTargets %>% group_by(Difficulty, Group, Subject) %>%
summarize(Priming = mean(Priming)) %>%
ggplot(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = Priming, group=Subject, colour = Group)) +
geom_point(size = 3, alpha = 0.5) +
geom_line(aes(x = factor(Difficulty, level = c("easier", "same", "harder")),
y = Priming, group=Subject, colour = Group)) +
theme_minimal(base_size = 18) +
ggtitle('Priming by Angle (RT1-RT2') + xlab('Difficulty')
```
These are maybe too busy to use, but could be worth producing these by-subject graphs side-by-side for each group.
Leaving out the item-level analysis code for now (which will be more relevant to the other paper) - let's move on to the LMMs.
## Mixed Model Analysis, 1st half of experiment
First attempt at the mixed model for the Error analysis on Primes only (i.e. 1st half of the experiment)
```{r PrimeErrors_model}
PrimeErrors <- mixed(ErrorRate ~ Angle*Group + (1 + Angle|Subject) +
(1 + Angle|Sign), vpAccPrimes, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(PrimeErrors)
summary(PrimeErrors)
```
Seems to converge... However I'm not sure if the random slope syntax is right (or for the following models). All participants see every sign once, but signs allowed to vary by angle (Angle). So diff ppts will see see same sign from diff angle. However, not all signs appear from every angle as items imbalanced.
Correlation of random effects probably too strong to be reliable - suggests something wrong with model? But if true, participants who have higher intercepts have steeper angle slopes. Makes sense that only the participants who found the task difficult at 0deg show a stronger interference effect of angle. (see Fig 81, p.271)
Multiple comparisons for the PrimeErrors model:
```{r primeAcc_model_pairwise}
PrimeAccPairwise = emmeans(PrimeErrors, specs = trt.vs.ctrl ~ Angle:Group, data = vpAccPrimes)
PrimeAccPairwise
```
Had to recode Angle as a factor in order to get it to work for multiple comparisons in emmeans
I specified '0,L1_Deaf' as the control (not sure if this is a good way to do it)
Now a first attempt at the mixed model for the RT analysis on Primes only (i.e. first half of the experiment)
```{r PrimeRT_model, message=FALSE}
PrimeRT <- mixed(Log10RT ~ Angle*Group + CorrResp + (1 + Angle|Subject) +
(1 + Angle|Sign), vpRTPrimes, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(PrimeRT)
summary(PrimeRT)
```
This also seems to converge? But having trouble interpreting the results due to LogRTs.
Multiple comparisons for the PrimeRT model:
```{r primeRT_model_pairwise}
PrimeRTPairwise = emmeans(PrimeRT, specs = trt.vs.ctrl ~ Angle:Group, data = vpRTPrimes)
PrimeRTPairwise
```
And now I'll try checking the assumptions of these models:
## Checking assumptions
The below doesn't seem to be working - even though the models are now converging. Is the normality assumption checked differently for a mixed effect model? Think I got confused with sum-coding the fixed effects... but I did previously manage to to replicate the example in your book for a simple linear model based on my data.
{r check_assumptions}
Group <- rep(c('L1_Deaf','L1_Hearing','L2_Fluent','L2_Intermediate'), each = 3)
Angle <- c(0, 45, 90, 0, 45, 90, 0, 45, 90, 0, 45, 90)
Angle <- as.factor(Angle)
sum <- mutate(vpAccPrimes,
Group_sum = factor(Group),
Angle_sum = factor(Angle))
sum
contrasts(sum$Group_sum) <- contr.sum(4)
contrasts(sum$Angle_sum) <- contr.sum(3)
sum_mdl <- mixed(ACC ~ Angle_sum*Group_sum + CorrResp + (1 + Angle|Subject) +
(1 + Angle|Sign), sum, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
res <- residuals(sum_mdl)
res
# Assess the normality assumption:
par(mfrow = c(1, 3))
# Plot 1, histogram:
hist(res) # distribution of residuals looks fairly normal
# Plot 2, Q-Q plot:
qqnorm(res)
qqline(res) # also indicates a good fit with normal distrib
# Plot 3, residual plot:
plot(fitted(sum_mdl), res) # all 12 cells have a fairly similar distribution
# possibly getting a bit larger for L2_Intermediate group further along y-axis
# check variance inflation factor:
vif(sum_mdl) # all btwn range of 1.0 - 1.05
## Mixed Model Analysis, 2nd half of experiment
Now we'll run LMMs on the data from the second half of the experiment. First modelling Change in Accuracy between Prime & Target as a function of Difficulty and Group.
```{r ChangeAcc_model}
ChangeAcc <- mixed(AccChange ~ Difficulty*Group + (1 + Difficulty|Subject),
vpAccTargets, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(ChangeAcc)
summary(ChangeAcc)
```
```{r accchange_model_pairwise}
AccChangePairwise = emmeans(ChangeAcc, specs = trt.vs.ctrl ~ Difficulty:Group, ref = 3, data = vpAccTargets)
AccChangePairwise
```
Now modelling Priming (diff between logRT1 & logRT2) as a function of Difficulty & Group:
```{r Priming_model}
RTPriming <- mixed(LogDiff ~ Difficulty*Group + CorrResp +
(1 + Difficulty|Subject),
vpRTTargets, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(RTPriming)
summary(RTPriming)
```
```{r priming_model_pairwise}
PrimingPairwise = emmeans(RTPriming, specs = trt.vs.ctrl ~ Difficulty:Group, ref = 3, data = vpRTTargets)
PrimingPairwise
```
## Sub-analyses
# Sign Type Mixed Models
```{r SignTypeErrors_model}
SignTypeErrors <- mixed(ErrorRate ~ Angle*SignType + (1 + Angle|Subject) +
(1 + Angle|Sign), vpAccPrimes, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(SignTypeErrors)
summary(SignTypeErrors)
```
```{r Sign_type_errors_pairwise}
vpAccPrimes$Angle <- as.factor(vpAccPrimes$Angle)
STEPairwise = emmeans(SignTypeErrors, pairwise ~ Angle:SignType, data = vpAccPrimes)
STEPairwise
```
```{r sign_type_RT}
SignTypeRT <- mixed(Log10RT ~ Angle*SignType + CorrResp + (1 + Angle|Subject) +
(1 + Angle|Sign), vpRTPrimes, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(SignTypeRT)
summary(SignTypeRT)
```
```{r Sign_type_RT_pairwise}
STRTPairwise = emmeans(SignTypeRT, pairwise ~ Angle:SignType, data = vpRTPrimes)
STRTPairwise
```
```{r sign_type_AccChange}
SignTypeAC <- mixed(AccChange ~ Difficulty*SignType + (1 + Difficulty|Subject),
vpAccTargets, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(SignTypeAC)
summary(SignTypeAC)
```
```{r Sign_type_AC_pairwise}
STACPairwise = emmeans(SignTypeAC, pairwise ~ Difficulty:SignType, data = vpAccTargets)
STACPairwise
```
```{r sign_type_Priming}
SignTypePriming <- mixed(LogDiff ~ Difficulty*SignType + CorrResp + (1 + Difficulty|Subject),
vpRTTargets, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(SignTypePriming)
summary(SignTypePriming)
```
```{r Sign_type_Priming_pairwise}
STPPairwise = emmeans(SignTypePriming, pairwise ~ Difficulty:SignType, data = vpRTTargets)
STPPairwise
```
# Iconicity Mixed Models
```{r Iconicity_errors_model}
vpIconAccPrimes <- filter(vpAccPrimes, IconRating != 0)
IconicityErrors <- mixed(ErrorRate ~ Angle*IconRating + (1 + Angle|Subject) +
(1 + Angle|Sign), vpIconAccPrimes, all_fit = TRUE, method =
"LRT", control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(IconicityErrors)
summary(IconicityErrors)
```
```{r Iconicity_RT_model}
vpIconRTPrimes <- filter(vpRTPrimes, IconRating != 0)
IconicityRT <- mixed(Log10RT ~ Angle*IconRating + CorrResp + (1 + Angle|Subject) +
(1 + Angle|Sign), vpIconRTPrimes, all_fit = TRUE, method =
"LRT", control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(IconicityRT)
summary(IconicityRT)
```
`` `{r Iconicity_AC_model}
vpIconAccChange <- filter(vpAccTargets, IconRating != 0)
IconicityAC <- mixed(AccChange ~ Difficulty*IconRating + (1 + Difficulty|Subject),
vpIconAccChange, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(IconicityAC)
summary(IconicityAC)
` ``
can't get this one to work: Error in anova.merMod(full_model, fits[[c]]) :
all models must be fit to the same data object
```{r Iconicity_priming_model}
vpIconPriming <- filter(vpRTTargets, IconRating != 0)
IconicityPriming <- mixed(LogDiff ~ Difficulty*IconRating + CorrResp +(1 + Difficulty|Subject),
vpIconPriming, all_fit = TRUE, method =
"LRT", control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(IconicityPriming)
summary(IconicityPriming)
```
# Noun Class Mixed Models
` ``{r NounClass_errors_model}
NCErrors <- mixed(ErrorRate ~ Angle*NounClass + (1 + Angle|Subject) +
(1 + Angle|Sign), vpAccPrimes, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(NCErrors)
summary(NCErrors)
` ``
` ``{r NounClass_RT_model}
NCRT <- mixed(Log10RT ~ Angle*NounClass + CorrResp + (1 + Angle|Subject) +
(1 + Angle|Sign), vpRTPrimes, all_fit = TRUE, method = "LRT",
control = lmerControl(optCtrl = list(maxfun = 1e6)))
print(NCRT)
summary(NCRT)
` ``
## Mental Rotation Analysis
Read in Mental Rotation data file, convert to tibble:
```{r read_in_mr_file}
mr <- read.delim("2019-06-03 mental rotation data.txt")
mr <- as_tibble(mr)
head(mr)
```
Check number of subjects and how many data points per subjects:
```{r check_trials}
length(unique(mr$Subject))
summary(mr$Subject)
```
7 subjects have <48 data points (S108, S110, S125, S126, S142, S143, S144) due to technical problems (experiment file crashing).
Exclude very fast (<500ms) or very slow (>10000ms) trials:
```{r no_slow_trials}
mr <- filter(mr, ExclSlow != 1)
```
Summarise the mean Accuracy & RT by Subject for the mental rotation task:
```{r mr_subject_averages}
mrAcc <- mr %>% group_by(Group, Subject) %>%
summarize(MR_ACC = mean(ACC))
print(mrAcc)
mrRT <- filter(mr, ACC == 1)
mrRT <- mrRT %>% group_by(Group, Subject) %>%
summarize(MR_RT = mean(RT))
print(mrRT)
```
There are around 13/45 subjects with accuracy between 40-60% suggesting they may have been guessing/didn't fully understand the task. I excluded these the first time I did this analysis but have left them in for now.
Haven't log transformed RTs here - not sure if should?
Summarise the mean Accuracy & RT by Subject for the BSL experiment (prime data only):
```{r bsl_subject_averages}
BSLAcc <- vpAccPrimes %>% group_by(Group, Subject) %>%
summarize(BSL_ACC = mean(ACC))
print(BSLAcc)
BSLRT <- vpRTPrimes %>% group_by(Group, Subject) %>%
summarize(BSL_RT = mean(RT))
print(BSLRT)
```
Bind tibbles:
```{r bind_tibbles}
AccCorr<- bind_cols(mrAcc, BSLAcc)
print(AccCorr)
RTCorr <- bind_cols(mrRT, BSLRT)
print(RTCorr)
```
This has duplicated the Group & Subject columns, I thought it would recognise they're the same and skip them? Oh well :)
```{r scatterplots}
ggplot(AccCorr, aes(x=MR_ACC, y=BSL_ACC, color=Group, shape=Group)) +
geom_point() +
geom_smooth(method=lm,se=FALSE) +
ggtitle('Mental Rotation Task Accuracy vs BSL Angle Task Accuracy')
ggplot(RTCorr, aes(x=MR_RT, y=BSL_RT, color=Group, shape=Group)) +
geom_point() +
geom_smooth(method=lm,se=FALSE) +
ggtitle('Mental Rotation Task RT vs BSL Angle Task RT')
```
Compute correlations between BSL task & Mental Rotation task for Accuracy & RT:
```{r correlations}
AccCorr %>% group_by(Group) %>%
summarize(AccCOR=cor(MR_ACC,BSL_ACC))
RTCorr %>% group_by(Group) %>%
summarize(RTCOR=cor(MR_RT,BSL_RT))
```
Not sure if this is the right way to calculate the correlations! Again these values seem quite high but maybe because R not Rsquared.
I've only looked at overall averages. In theory it would be possible to correlate by type of rotation e.g. 45deg sign vs 50deg shape rotation, 90deg sign vs 100deg shape rotation but I don't think there are enough items (only a very short test).
I wonder if it is worth reducing the data to just the conditions requiring rotation (ie. 45 & 90 for BSL; 50, 100, 150 for MR). We don't expect rotation to 0-degree signs, and there is no rotation required for two identical shapes.. So this correlation as is also has lots of non-rotation in the mix
In terms of interpreting the results, I would say that the RT correlation is of far more value than the Accuracy one, since the 3 fluent groups are performing at ceiling accuracy on the BSL task.
BSL task data per subject, 45 & 90 angles only:
```{r BSL_no0}
BSLAccNo0 <- filter(vpAccPrimes, Angle != "0")
BSLAccNo0 <- BSLAccNo0 %>% group_by(Group, Subject) %>%
summarize(BSL_ACC = mean(ACC))
print(BSLAccNo0)
BSLRTNo0 <- filter(vpRTPrimes, Angle != "0", ACC != 0)
BSLRTNo0 <- BSLRTNo0 %>% group_by(Group, Subject) %>%
summarize(BSL_RT = mean(RT))
print(BSLRTNo0)
```
MR task data per subject, 50, 100 & 150 rotations only:
```{r MR_no0}
mrAccNo0 <- filter(mr, Rotation != "0")
mrAccNo0 <- mrAccNo0 %>% group_by(Group, Subject) %>%
summarize(MR_ACC = mean(ACC))
print(mrAccNo0)
mrRTNo0 <- filter(mr, Rotation != "0", ACC == 1)
mrRTNo0 <- mrRTNo0 %>% group_by(Group, Subject) %>%
summarize(MR_RT = mean(RT))
print(mrRTNo0)
```
Combine tibbles for no 0 data:
```{r combine_no0_tibbles}
AccCorrNo0 <- bind_cols(mrAccNo0, BSLAccNo0)
print(AccCorrNo0)
RTCorrNo0 <- bind_cols(mrRTNo0, BSLRTNo0)
print(RTCorrNo0)
```
Create scatter plots for no 0 data:
```{r no0_scatterplots}
ggplot(AccCorrNo0, aes(x=MR_ACC, y=BSL_ACC, color=Group, shape=Group)) +
geom_point() +
geom_smooth(method=lm,se=FALSE) +
ggtitle('Mental Rotation Task Accuracy (no 0) vs BSL Angle Task Accuracy (no 0)')
ggplot(RTCorrNo0, aes(x=MR_RT, y=BSL_RT, color=Group, shape=Group)) +
geom_point() +
geom_smooth(method=lm,se=FALSE) +
ggtitle('Mental Rotation Task RT (no 0) vs BSL Angle Task RT (no 0)')
```
Compute no0 correlations between BSL & Mental Rotation tasks:
```{r no0_correlations}
AccCorrNo0 %>% group_by(Group) %>%
summarize(AccCORno0=cor(MR_ACC,BSL_ACC))
RTCorrNo0 %>% group_by(Group) %>%
summarize(RTCORno0=cor(MR_RT,BSL_RT))
```