-
Notifications
You must be signed in to change notification settings - Fork 0
/
imr_gpwr_wa_lingvang_revision_codes.R
1228 lines (1077 loc) · 73.3 KB
/
imr_gpwr_wa_lingvang_revision_codes.R
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: "R Notebook for *Corpus linguistic and experimental studies on meaning-preserving hypothesis in Indonesian voice alternation*"
#' author:
#' - name: '[I Made Rajeg](https://udayananetworking.unud.ac.id/lecturer/1817-i-made-rajeg) <a itemprop="sameAs" content="https://orcid.org/0000-0001-8989-0203" href="https://orcid.org/0000-0001-8989-0203" target="orcid.widget" rel="noopener noreferrer" style="vertical-align:top;"><img src="https://orcid.org/sites/default/files/images/orcid_16x16.png" style="width:1em;margin-right:.5em;" alt="ORCID iD icon"></a>^1^, [Gede Primahadi Wijaya Rajeg](https://udayananetworking.unud.ac.id/lecturer/880-gede-primahadi-wijaya-rajeg) <a itemprop="sameAs" content="https://orcid.org/0000-0002-2047-8621" href="https://orcid.org/0000-0002-2047-8621" target="orcid.widget" rel="noopener noreferrer" style="vertical-align:top;"><img src="https://orcid.org/sites/default/files/images/orcid_16x16.png" style="width:1em;margin-right:.5em;" alt="ORCID iD icon"></a>^1^, [I Wayan Arka](https://researchers.anu.edu.au/researchers/arka-iww) <a itemprop="sameAs" content="https://orcid.org/0000-0002-2819-6186" href="https://orcid.org/0000-0002-2819-6186" target="orcid.widget" rel="noopener noreferrer" style="vertical-align:top;"><img src="https://orcid.org/sites/default/files/images/orcid_16x16.png" style="width:1em;margin-right:.5em;" alt="ORCID iD icon"></a>^2,^ ^1^'
#' affiliation: "Universitas Udayana ^1^, Australian National University ^2^"
#' output:
#' html_notebook:
#' code_folding: show
#' fig_caption: yes
#' fig_width: 6
#' number_sections: yes
#' toc: yes
#' toc_float: no
#' pdf_document:
#' toc: yes
#' bookdown::pdf_document2:
#' df_print: tibble
#' fig_caption: yes
#' number_sections: yes
#' bookdown::word_document2:
#' df_print: kable
#' fig_caption: yes
#' fig_width: 6
#' bibliography: reference.bib
#' csl: unified_stylesheet_linguistics.csl
#' ---
#'
## ----setup, include = FALSE, message = FALSE, warning = FALSE, echo = FALSE---------
knitr::opts_chunk$set(fig.width = 7,
fig.asp = 0.618,
fig.retina = 2,
dpi = 300,
dev = "pdf",
tidy = FALSE,
echo = FALSE)
library(tidyverse)
library(broom)
library(readxl)
library(vcd)
#'
#'
#' <!-- badges: start -->
#' <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This R Notebook and the analyses codes are licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
#' <!-- badges: end -->
#'
#' # How to cite this R notebook {-}
#'
#' Please cite this notebook as follows (in Unified Style Sheet for Linguistics) [@rajeg_supplementary_2021]:
#'
#' - to be filled with the citation of the paper to appear in [*Linguistics Vanguard*](https://www.degruyter.com/journal/key/LINGVAN/html)
#'
#' - Rajeg, I Made, Gede Primahadi Wijaya Rajeg & I Wayan Arka. 2021. R Notebook for “Corpus linguistic and experimental studies on meaning-preserving hypothesis in Indonesian voice alternation.” Open Science Framework. doi: [10.17605/OSF.IO/QF38H](https://doi.org/10.17605/OSF.IO/QF38H). url: [https://osf.io/qf38h/](https://osf.io/qf38h/).
#'
#'
#' # Introduction {#intro}
#'
#'
## ----load-elicitation-data, message = FALSE, warning = FALSE, eval = TRUE, include = TRUE----
corpsize <- readr::read_tsv('corpus_total_size_per_file.txt')
corpsizeused <- subset(corpsize, grepl("_newscrawl_", corpus_id))
memajukan_exp <- readRDS("memajukan_exp.rds")
memajukan_exp1 <- memajukan_exp %>%
filter(!sense %in% c("duplicate"), P_anim != "INTR")
dimajukan_exp <- readRDS("dimajukan_exp.rds")
dimajukan_exp1 <- dimajukan_exp %>%
filter(sense != "duplicate")
majukan_exp <- readRDS("majukan_exp.rds")
majukan_exp1 <- majukan_exp %>%
filter(!clause_type %in% c("IRRELEVANT", "duplicate", "unclear"))
majukan_exp1_declarative <- majukan_exp1 %>%
filter(clause_type %in% c("declarative"))
memundurkan_exp <- readRDS("memundurkan_exp.rds")
memundurkan_exp1 <- memundurkan_exp %>%
filter(!sense %in% c("IRRELEVANT", "duplicate", "unclear"))
dimundurkan_exp <- readRDS("dimundurkan_exp.rds")
dimundurkan_exp1 <- dimundurkan_exp %>%
filter(!sense %in% c("IRRELEVANT", "duplicate", "unclear"))
mundurkan_exp <- readRDS("mundurkan_exp.rds")
mundurkan_exp1 <- mundurkan_exp %>% filter(!sense %in% c("IRRELEVANT", "duplicate", "unclear"))
mundurkan_exp1_declarative <- mundurkan_exp1 %>% filter(clause_type == "declarative")
mengajukan_exp <- readRDS("mengajukan_exp.rds")
mengajukan_exp1 <- mengajukan_exp %>% filter(!sense %in% c("duplicate", "unclear"))
diajukan_exp <- readRDS("diajukan_exp.rds")
diajukan_exp1 <- diajukan_exp %>%
filter(!sense %in% c("duplicate", "IRRELEVANT")) %>%
mutate(sense = replace(sense, sense %in% c("report", "temporal"), "others")) %>%
filter(sense != "others")
ajukan_exp <- readRDS("ajukan_exp.rds")
ajukan_exp1 <- ajukan_exp %>%
filter(!sense %in% c("duplicate", "IRRELEVANT", "unclear"))
ajukan_exp1_declarative <- ajukan_exp1 %>%
filter(clause_type == "declarative")
mengundur_exp <- readRDS("mengundur_exp.rds")
mengundur_exp1 <- mengundur_exp %>%
filter(!sense %in% c("duplicate", "IRRELEVANT", "unclear"))
diundur_exp <- readRDS("diundur_exp.rds")
diundur_exp1 <- diundur_exp %>%
filter(!sense %in% c("duplicate", "IRRELEVANT", "unclear"))
mengundurkan_exp <- readRDS("mengundurkan_exp.rds")
mengundurkan_exp1 <- mengundurkan_exp %>%
filter(!sense %in% c("duplicate", "IRRELEVANT", "unclear"))
diundurkan_exp <- readRDS("diundurkan_exp.rds")
# diundurkan_exp1 <- diundurkan_exp %>%
# filter(!sense %in% c("duplicate", "IRRELEVANT", "unclear")) %>%
# slice_sample(n = 100)
# load only experimental data for *diundurkan* that has been randomly sampled to 100 tokens
diundurkan_exp1 <- readRDS("diundurkan_exp_100_sample.rds")
undurkan_exp <- readRDS("undurkan_exp.rds")
undurkan_exp1 <- undurkan_exp %>%
filter(!sense %in% c("duplicate", "IRRELEVANT", "unclear"))
undurkan_exp1_declarative <- undurkan_exp1 %>%
filter(clause_type == "declarative")
exp_database <- data.frame(verbs = c("memajukan", "dimajukan", "majukan",
"memundurkan", "dimundurkan", "mundurkan",
"mengajukan", "diajukan", "ajukan",
"mengundur", "diundur",
"mengundurkan", "diundurkan", "undurkan"),
cases = c(nrow(memajukan_exp), nrow(dimajukan_exp),
nrow(majukan_exp), nrow(memundurkan_exp),
nrow(dimundurkan_exp), nrow(mundurkan_exp),
nrow(mengajukan_exp), nrow(diajukan_exp),
nrow(ajukan_exp), nrow(mengundur_exp),
nrow(diundur_exp), nrow(mengundurkan_exp),
nrow(diundurkan_exp), nrow(undurkan_exp)),
relevant = c(nrow(memajukan_exp1), nrow(dimajukan_exp1),
nrow(majukan_exp1), nrow(memundurkan_exp1),
nrow(dimundurkan_exp1), nrow(mundurkan_exp1),
nrow(mengajukan_exp1), nrow(diajukan_exp1),
nrow(ajukan_exp1), nrow(mengundur_exp1),
nrow(diundur_exp1), nrow(mengundurkan_exp1),
nrow(diundurkan_exp1), nrow(undurkan_exp1)))
memundurkan_exp1_sense_count <- memundurkan_exp1 %>%
count(sense, node, sort = TRUE)
dimundurkan_exp1_sense_count <- dimundurkan_exp1 %>%
count(sense, node, sort = TRUE)
mundurkan_exp1_declarative_sense_count <- count(mundurkan_exp1_declarative,
sense, node, sort = TRUE)
mundurkan_exp1_declarative_sense_count_by_voice <- count(mundurkan_exp1_declarative,
sense, voice, node, sort = TRUE)
mundurkan_exp1_declarative_voice_count <- count(mundurkan_exp1_declarative,
voice, node, sort = TRUE)
mengundurkan_exp1_sense_count <- mengundurkan_exp1 %>%
count(sense, node, sort = TRUE)
diundurkan_exp1_sense_count <- diundurkan_exp1 %>%
count(sense, node, sort = TRUE)
undurkan_exp1_declarative_sense_count <- count(undurkan_exp1_declarative,
sense, node, sort = TRUE)
undurkan_exp1_declarative_sense_count_by_voice <- count(undurkan_exp1_declarative,
sense, voice, node, sort = TRUE)
undurkan_exp1_declarative_voice_count <- count(undurkan_exp1_declarative,
voice, node, sort = TRUE)
mengajukan_exp1_subsense_count <- mengajukan_exp1 %>%
count(sense, node, sort = TRUE)
diajukan_exp1_subsense_count <- diajukan_exp1 %>%
count(sense, node, sort = TRUE)
ajukan_exp1_declarative_sense_count <- count(ajukan_exp1_declarative,
sense, node, sort = TRUE)
ajukan_exp1_declarative_voice_count <- count(ajukan_exp1_declarative,
voice, node, sort = TRUE)
ajukan_exp1_declarative_sense_count_by_voice <- count(ajukan_exp1_declarative,
sense, voice, node, sort = TRUE)
dimajukan_exp1_sense_count <- count(dimajukan_exp1,
sense, node, sort = TRUE)
memajukan_exp1_sense_count <- count(memajukan_exp1,
sense, node, sort = TRUE)
majukan_exp1_declarative_sense_count <- count(majukan_exp1_declarative,
sense, node, sort = TRUE)
majukan_exp1_declarative_voice_count <- count(majukan_exp1_declarative,
voice, node, sort = TRUE)
majukan_exp1_declarative_sense_count_by_voice <- count(majukan_exp1_declarative,
sense, voice, node, sort = TRUE)
mengundur_exp1_sense_count <- mengundur_exp1 %>%
count(sense, node, sort = TRUE)
diundur_exp1_sense_count <- diundur_exp1 %>%
count(sense, node, sort = TRUE)
#'
#' # Data and methodology {#datamethod}
#'
#' [[Table \@ref(tab:table1-corpus-data)](#table1-corpus-data)]).
#'
## ----table1-corpus-data, message = FALSE, warning=FALSE-----------------------------
## TABLE 1 ========
corpsizeused %>%
rename(Filenames = corpus_id,
`Size (in word-tokens)` = total_tokens) %>%
mutate(`Size (in word-tokens)` = format(`Size (in word-tokens)`, big.mark = ",")) %>%
knitr::kable(caption = "Corpus files used and their sizes", row.names = TRUE)
#'
#' [Table \@ref(tab:table2-lexemes-database-count)](#table2-lexemes-database-count).
#'
## ----table2-lexemes-database-count, message = FALSE, warning = FALSE----------------
## TABLE 2 ========
lexemes_all <- readr::read_tsv("lexemes_all_database.txt")
lexemes_all_database <- lexemes_all %>%
select(base, affixes, n) %>%
pivot_wider(names_from = affixes,
values_from = n,
values_fill = 0) %>%
mutate(base = fct_relevel(as.factor(base), c("majukan", "mundurkan", "aju", "ajukan", "undur", "undurkan"))) %>%
arrange(base) %>%
mutate(gloss = "gloss here",
base = paste("*", base, "*", sep = "")) %>%
select(base, -gloss, unprefixed, `meN-`, `di-`) %>%
column_to_rownames("base") %>%
as.matrix()
lexemes_all_database_perc <- round(prop.table(lexemes_all_database, 1)*100, 2)
knitr::kable(format(addmargins(lexemes_all_database), big.mark = ","), caption = "Distribution of bases and their voice morphologies")
#'
#' ## Metaphor analysis {#metapanalysis}
#'
#' # Analysis for *majukan*, *memajukan* and *dimajukan* {#majukan-all}
#'
#' ## Corpus data for *majukan*
#'
## ----majukan-voice-and-sense-categorising-new---------------------------------------
# read the concordance data
majukan <- readRDS("majukan_BARE_all_data.rds") %>%
mutate(node = tolower(node))
#'
## ----majukan-voice-count-new--------------------------------------------------------
majukan_voice_tb <- majukan %>%
filter(str_detect(sense, "^irrel", negate = TRUE)) %>%
count(voice, sort = TRUE) %>%
mutate(perc = round((n/sum(n) * 100), 2))
#'
## ----majukan_phys_motion_examples---------------------------------------------------
majukan_phys_motion_df <- subset(majukan, sense=="phys_motion")
#'
## ----memajukan-load-data------------------------------------------------------------
memajukan <- readRDS("majukan_AV_sample_data.rds") %>%
filter(senses != "duplicate") %>%
rename(sense = senses) %>%
mutate(node = tolower(node))
#'
## ----dimajukan-load-data------------------------------------------------------------
dimajukan <- readRDS("majukan_PASS_sample_data.rds") %>%
filter(!sense %in% c("duplicate", "phys_motion")) %>%
mutate(node = tolower(node))
dimajukan_physmotion <- readRDS("majukan_PASS_sample_data.rds") %>%
filter(sense %in% c("phys_motion"))
#'
## ----majukan-combined-voice---------------------------------------------------------
memajukan1 <- memajukan %>%
select(node, sense) %>%
mutate(voice = "av")
dimajukan1 <- dimajukan %>%
select(node, sense) %>%
mutate(voice = "pass")
majukan1 <- majukan %>%
filter(str_detect(sense, "^(irrel|phys_m)", negate = TRUE)) %>%
select(node, sense, voice)
majukan_combined <- bind_rows(filter(majukan1, voice == "uv"),
memajukan1,
dimajukan1) %>%
mutate(sense = replace(sense, sense == "propose", "proposing"),
sense = as.factor(sense),
sense = fct_relevel(sense, "proposing", after = 3))
majukan_voice_count <- table(majukan_combined$voice)
majukan_combined_goodness_of_fit <- chisq.test(majukan_voice_count)
#'
#' Codes to generate [Figure \@ref(fig:figure1-majukan-voice-plot)](#figure1-majukan-voice-plot).
#'
## ----figure1-majukan-voice-plot, fig.cap="Distribution of voice for the metaphoric usages of the base *majukan*"----
# saving to computer
## FIGURE 1 ========
majukan_voice_count_interim <- majukan_voice_count %>% data.frame()
fig1 <- majukan_voice_count_interim %>%
rename(voice = Var1, n = Freq) %>%
mutate(voice = toupper(voice)) %>%
ggplot(aes(x = voice, y = n, fill = voice)) +
geom_col() +
geom_text(aes(label = paste("N=", n, sep = "")), vjust = -.35, size = 3.5) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(11, "RdYlBu")[1],
RColorBrewer::brewer.pal(11, "RdYlBu")[8],
RColorBrewer::brewer.pal(11, "RdYlBu")[5])) +
theme_bw() +
theme(legend.position = 'none') +
labs(y = "Raw frequency", x = "Voice", caption = bquote(paste(italic(X)["goodness-of-fit"]^2, "=", .(round(majukan_combined_goodness_of_fit$statistic, 2)), "; ", italic(df), "=", .(majukan_combined_goodness_of_fit$parameter), "; ", italic(p)["two-tailed"], .(if(majukan_combined_goodness_of_fit$p.value < 0.001) " < 0.001"))))
# Uncomment (i.e. delete the hashtag) the following line to activate the code line to save the plot to computer
# fig1 + ggsave("figs/figure-1.jpeg", width = 6, height = 5, dpi = 600)
fig1
majukan_voice_count %>%
data.frame() %>%
rename(voice = Var1, n = Freq) %>%
mutate(voice = toupper(voice)) %>%
ggplot(aes(x = voice, y = n, fill = voice)) +
geom_col() +
geom_text(aes(label = paste("N=", n, sep = "")), vjust = -.35, size = 2.75) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(11, "RdYlBu")[1],
RColorBrewer::brewer.pal(11, "RdYlBu")[8],
RColorBrewer::brewer.pal(11, "RdYlBu")[5])) +
theme_bw() +
theme(legend.position = 'none') +
labs(y = "Raw frequency", x = "Voice", caption = bquote(paste(italic(X)["goodness-of-fit"]^2, "=", .(round(majukan_combined_goodness_of_fit$statistic, 2)), "; ", italic(df), "=", .(majukan_combined_goodness_of_fit$parameter), "; ", italic(p)["two-tailed"], .(if(majukan_combined_goodness_of_fit$p.value < 0.001) " < 0.001"))))
#'
#'
#' Codes for *Chi-square Test* of Independence.
#'
## ----majukan-combined-av-pass-chisquare---------------------------------------------
majukan_combined_av_pass <- filter(majukan_combined, voice != "uv")
majukan_combined_av_pass_chisq0 <- majukan_combined_av_pass %>%
count(sense, voice) %>%
pivot_wider(values_from = "n", names_from = voice) %>%
data.frame(row.names = 1) %>%
chisq.test()
majukan_combined_av_pass_chisq <- majukan_combined_av_pass_chisq0 %>%
broom::tidy()
majukan_combined_av_pass_assocstats <- majukan_combined_av_pass %>%
count(sense, voice) %>%
pivot_wider(values_from = "n", names_from = voice) %>%
data.frame(row.names = 1) %>%
as.matrix() %>%
vcd::assocstats()
#'
#' Code for [Figure \@ref(fig:figure2-majukan-combined-av-pass-plot)](#figure2-majukan-combined-av-pass-plot).
#'
## ----figure2-majukan-combined-av-pass-plot, fig.cap="Distribution of metaphoric senses of *majukan* across AV and PASS"----
majukan_combined_av_pass_count <- majukan_combined_av_pass %>% count(voice, sense) %>% group_by(voice) %>% mutate(perc = n/sum(n)*100) %>% ungroup()
# PERCENTAGES-----
# saving to computer
## FIGURE 2 =============
fig2 <- majukan_combined_av_pass_count %>%
mutate(voice = toupper(voice),
sense = as.character(sense),
sense = replace(sense, sense=='temporal', 'cause to happen earlier'),
sense = as.factor(sense),
sense = fct_relevel(sense)) %>%
ggplot(aes(x = voice, y = perc, fill = sense)) +
geom_col(position = position_dodge(.9)) +
# scale_fill_brewer(palette = "PuBu", type = "qual", direction = -1) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(9, "YlGnBu")[7],
RColorBrewer::brewer.pal(9, "YlGnBu")[4],
RColorBrewer::brewer.pal(9, "YlGnBu")[2])) +
theme_bw() +
geom_text(aes(label = paste("N=", n, sep = "")), position = position_dodge(.9), vjust = -.35, size = 3.5) +
theme(legend.position = "top") +
labs(x = "Voice", y = "Percentages", fill = "Metaphoric senses", caption = bquote(paste(italic(X)["independence"]^2, "=", .(round(majukan_combined_av_pass_chisq$statistic, 2)), "; ", italic(df), "=", .(majukan_combined_av_pass_chisq$parameter), "; ", italic(p)["two-tailed"], "=", .(if(majukan_combined_av_pass_chisq$p.value < 0.001) " < 0.001"), "; Cramér's ", italic(V), "=", .(round(majukan_combined_av_pass_assocstats$cramer, 3)))))
# Uncomment (i.e. delete the hashtag) the following line to activate the code line to save the plot to computer
# fig2 + ggsave("figs/figure-2.jpeg", width = 7, height = 5.5, dpi = 600)
majukan_combined_av_pass_count %>%
mutate(voice = toupper(voice),
sense = as.character(sense),
sense = replace(sense, sense=='temporal', 'cause to happen earlier'),
sense = as.factor(sense),
sense = fct_relevel(sense)) %>%
ggplot(aes(x = voice, y = perc, fill = sense)) +
geom_col(position = position_dodge(.9)) +
# scale_fill_brewer(palette = "PuBu", type = "qual", direction = -1) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(9, "YlGnBu")[7],
RColorBrewer::brewer.pal(9, "YlGnBu")[4],
RColorBrewer::brewer.pal(9, "YlGnBu")[2])) +
theme_bw() +
geom_text(aes(label = paste("N=", n, sep = "")), position = position_dodge(.9), vjust = -.35, size = 2.75) +
theme(legend.position = "top") +
labs(x = "Voice", y = "Percentages", fill = "Metaphoric senses", caption = bquote(paste(italic(X)["independence"]^2, "=", .(round(majukan_combined_av_pass_chisq$statistic, 2)), "; ", italic(df), "=", .(majukan_combined_av_pass_chisq$parameter), "; ", italic(p)["two-tailed"], "=", .(if(majukan_combined_av_pass_chisq$p.value < 0.001) " < 0.001"), "; Cramér's ", italic(V), "=", .(round(majukan_combined_av_pass_assocstats$cramer, 3)))))
#'
#' Such asymmetric distribution effect of metaphoric senses across voice for *majukan* is statistically highly significant (*X*^2^=`r round(majukan_combined_av_pass_chisq$statistic, 2)`; *df*=`r majukan_combined_av_pass_chisq$parameter`; *p*~two-tailed~=`r if(majukan_combined_av_pass_chisq$p.value < 0.001) " < 0.001"`) with a highly strong effect size (Cramér's *V*=`r round(majukan_combined_av_pass_assocstats$cramer, 3)`)^[The interpretation of the effect size follows that given in Levshina [-@levshina_how_2015, 209]: 0.1 $\leq$ *V* $\lt$ 0.3 indicates small effect; 0.3 $\leq$ *V* $\lt$ 0.5 indicates moderate effect; *V* $\gt$ 0.5 indicates large or strong effect.].
#'
#' Association plot ([Figure \@ref(fig:figure3-majukan-combined-assocplot)](#figure3-majukan-combined-assocplot)).
#'
#'
## ----figure3-majukan-combined-assocplot, fig.cap="Association plot between metaphoric senses of *majukan* with AV and PASS.", fig.asp = .8----
## FIGURE 3 ===========
# Uncomment (i.e. delete the hashtags in) from the following three lines to activate the code to save the plot in computer
# png("figs/figure-3.jpeg", width = 7, height = 6, units = "in", res = 600)
# vcd::assoc(voice~sense, mutate(majukan_combined_av_pass, voice = toupper(voice)), shade = TRUE, legend = legend_resbased(fontsize = 10), gp_labels = gpar(fontsize = 9), labeling_args = list(set_varnames = c(voice = "Voice", sense = "Senses"), set_labels = list(sense = c("advancing", "cause to happen earlier", "proposing"))))
# dev.off()
vcd::assoc(voice~sense, mutate(majukan_combined_av_pass, voice = toupper(voice)), shade = TRUE, legend = legend_resbased(fontsize = 10), gp_labels = gpar(fontsize = 9), labeling_args = list(set_varnames = c(voice = "Voice", sense = "Senses"), set_labels = list(sense = c("advancing", "cause to happen earlier", "proposing"))))
#'
#' ## Experimental data for *majukan*
#'
#' Codes for experimental data for *majukan*.
#'
## ----majukan-exp-meta-lit-count-----------------------------------------------------
majukan_exp_meta_lit_sense <- majukan_exp1 %>%
count(sense, node, sort = T) %>%
mutate(perc = round(n/sum(n)*100, 2)) %>%
bind_rows(memajukan_exp1_sense_count %>%
mutate(perc = round(n/sum(n)*100, 2))) %>%
bind_rows(dimajukan_exp1_sense_count %>%
mutate(perc = round(n/sum(n)*100, 2))) %>%
arrange(node) %>%
mutate(sense_type = if_else(str_detect(sense, "^phys"), "lit", "met"))
majukan_exp_meta_lit_root <- majukan_exp1 %>%
count(sense, clause_type, node, sort = T) %>%
group_by(sense) %>%
mutate(perc = round(n/sum(n)*100, 2)) %>%
arrange(sense) %>%
ungroup()
majukan_exp_met_lit_by_word <- majukan_exp_meta_lit_sense %>%
group_by(node, sense_type) %>%
summarise(n=sum(n),perc=sum(perc), .groups = 'drop') %>%
group_by(node) %>%
mutate(total = sum(n),
pbin = map_dbl(pmap(list(x = n, n = total), binom.test), "p.value"),
dec = if_else(pbin >= 0.05, "ns", "***"),
dec = if_else(pbin < 0.05, "*", dec),
dec = if_else(pbin < 0.01, "**", dec),
dec = if_else(pbin < 0.001, "***", dec))
#'
#'
#' In experimental data, metaphoric senses are the predominant tokens for each *majukan* (N=`r pull(filter(majukan_exp_met_lit_by_word, node=='majukan', sense_type=='met'), n)`; `r pull(filter(majukan_exp_met_lit_by_word, node=='majukan', sense_type=='met'), perc)`%), *memajukan* (N=`r pull(filter(majukan_exp_met_lit_by_word, node=='memajukan', sense_type=='met'), n)`; `r pull(filter(majukan_exp_met_lit_by_word, node=='memajukan', sense_type=='met'), perc)`%), and *dimajukan* (N=`r pull(filter(majukan_exp_met_lit_by_word, node=='dimajukan', sense_type=='met'), n)`; `r pull(filter(majukan_exp_met_lit_by_word, node=='dimajukan', sense_type=='met'), perc)`%) over their literal, physical motion sense. For *majukan*, `r majukan_exp_meta_lit_root %>% filter(sense!="phys_motion") %>% group_by(clause_type) %>% summarise(n=sum(n), .groups='drop') %>% mutate(perc = round(n/sum(n)*100, 2)) %>% filter(clause_type=='imperative') %>% pull(perc)`% (N=`r majukan_exp_meta_lit_root %>% filter(sense!="phys_motion") %>% group_by(clause_type) %>% summarise(n=sum(n), .groups='drop') %>% mutate(perc = round(n/sum(n)*100, 2)) %>% filter(clause_type=='imperative') %>% pull(n)`) of its `r pull(filter(majukan_exp_met_lit_by_word, node=='majukan', sense_type=='met'), n)` metaphoric tokens are in imperative clause, and `r majukan_exp_meta_lit_root %>% filter(sense!="phys_motion") %>% group_by(clause_type) %>% summarise(n=sum(n), .groups='drop') %>% mutate(perc = round(n/sum(n)*100, 2)) %>% filter(clause_type=='declarative') %>% pull(n)` tokens are in declarative clause, of which only `r majukan_exp1_declarative_sense_count_by_voice %>% filter(sense!='phys_motion', voice=='uv') %>% pull(n)` is in UV. The literal sense of *majukan* is significantly greater in PASS *di-* (N=`r filter(majukan_exp_met_lit_by_word, sense_type=='lit', node != "majukan", node=='dimajukan')$n`) compared to AV *meN-* (N=`r filter(majukan_exp_met_lit_by_word, sense_type=='lit', node != "majukan", node=='memajukan')$n`) (*X*^2^~goodness-of-fit~=`r chisq.test(filter(majukan_exp_met_lit_by_word, sense_type=='lit', node != "majukan")$n)$statistic`; *df*=`r chisq.test(filter(majukan_exp_met_lit_by_word, sense_type=='lit', node != "majukan")$n)$parameter`; *p*~two-tailed~`r if(chisq.test(filter(majukan_exp_met_lit_by_word, sense_type=='lit', node != "majukan")$n)$p.value < 0.05) paste(" < 0.05") else if(chisq.test(filter(majukan_exp_met_lit_by_word, sense_type=='lit', node != "majukan")$n)$p.value < 0.01) paste(" < 0.01") else if(chisq.test(filter(majukan_exp_met_lit_by_word, sense_type=='lit', node != "majukan")$n)$p.value < 0.001) paste(" < 0.001")`).
#'
#'
#' [Figure \@ref(fig:figure4-majukan-exp-metaphoric-lit-sense-plot)](#figure4-majukan-exp-metaphoric-lit-sense-plot) visualises the distribution of metaphoric and literal senses across voice for EXPERIMENTAL DATA.
#'
#'
## ----figure4-majukan-exp-metaphoric-lit-sense-plot, fig.cap="Distribution of metaphoric and literal senses of *majukan* in AV and PASS (sentence-production)."----
majukan_exp_sense_av_pass <- bind_rows(memajukan_exp1_sense_count,dimajukan_exp1_sense_count, select(filter(majukan_exp1_declarative_sense_count_by_voice, voice == "av"), -voice)) %>% mutate(voice = "pass", voice = if_else(str_detect(node, "^di", negate = TRUE), "av", voice))
majukan_exp_sense_av_pass_plotdf <- majukan_exp_sense_av_pass %>%
filter(node != "majukan") %>%
group_by(voice, sense) %>%
summarise(n = sum(n), .groups = 'drop') %>%
group_by(voice) %>%
mutate(perc = round(n/sum(n)*100, 2)) %>%
ungroup() %>%
mutate(sense = replace(sense, sense=="phys_motion", "LIT. caused forward motion"),
voice = fct_relevel(as.factor(voice), c("av", "pass")),
sense = fct_relevel(as.factor(sense), c("advancing", "temporal", "LIT. caused forward motion")))
majukan_exp_sense_av_pass_chisq <- majukan_exp_sense_av_pass_plotdf %>%
pivot_wider(-perc, names_from = voice, values_from = n) %>%
column_to_rownames('sense') %>%
as.matrix() %>%
chisq.test()
majukan_exp_sense_av_pass_cramer <- round(assocstats(majukan_exp_sense_av_pass_chisq$observed)$cramer, 3)
## FIGURE 4 =========
fig4 <- majukan_exp_sense_av_pass_plotdf %>%
mutate(sense = as.character(sense),
sense = replace(sense, sense=='temporal', 'cause to happen earlier'),
sense = as.factor(sense),
sense = fct_relevel(sense)) %>%
ggplot(aes(x = toupper(voice), y = perc, fill = sense)) +
geom_col(position = position_dodge(.9)) +
# scale_fill_brewer(palette = "PuBu", type = "qual", direction = -1) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(9, "YlGnBu")[7],
RColorBrewer::brewer.pal(9, "YlGnBu")[4],
RColorBrewer::brewer.pal(9, "YlGnBu")[1])) +
theme_bw() +
geom_text(aes(label = paste("N=", n, sep = "")), position = position_dodge(.9), vjust = -.35, size = 3.5) +
theme(legend.position = "top") +
labs(x = "Voice", y = "Percentages", fill = "Senses", caption = bquote(paste(italic(X)["independence"]^2, "=", .(round(majukan_exp_sense_av_pass_chisq$statistic, 2)), "; ", italic(df), "=", .(majukan_exp_sense_av_pass_chisq$parameter), "; ", italic(p)["two-tailed"], .(if(majukan_exp_sense_av_pass_chisq$p.value < 0.001) " < 0.001" else if(majukan_exp_sense_av_pass_chisq$p.value < 0.01) " < 0.01" else if(majukan_exp_sense_av_pass_chisq$p.value < 0.05) " < 0.05" else if(majukan_exp_sense_av_pass_chisq$p.value >= 0.05) paste("=", round(majukan_exp_sense_av_pass_chisq$p.value, 3))), "; Cramér's ", italic(V), "=", .(majukan_exp_sense_av_pass_cramer))))
# Uncomment (i.e. delete the hashtag) the following line to activate the code line to save the plot to computer
# fig4 + ggsave("figs/figure-4.jpeg", width = 7, height = 5.5, dpi = 600)
fig4
#'
#' There is converging trend between the metaphoric senses in the corpus and experimental data, with the exception of the absense of 'proposing' sense in experimental data.
#'
#'
## ----figure5-majukan-exp-met-lit-combined-assocplot, fig.cap="Association plot between metaphoric and literal senses of *majukan* in AV and PASS from sentence-production experiment.", fig.asp=.85----
## FIGURE 5 ===========
names(dimnames(majukan_exp_sense_av_pass_chisq$observed)) <- c("sense", "voice")
# Uncomment (i.e. delete the hashtags in) the following three lines to activate the code to save the plot in computer
# png("figs/figure-5.jpeg", width = 7, height = 6, units = "in", res = 600)
# vcd::assoc(majukan_exp_sense_av_pass_chisq$observed[c(1, 3, 2), ], shade = TRUE, legend = legend_resbased(fontsize = 10), gp_labels = gpar(fontsize = 7.75), labeling_args = list(set_varnames = c(voice = "Voice", sense = "Senses")), set_labels = list(voice = c("AV", "PASS"), sense = c("advancing", "cause to happen earlier", "LIT. caused forward motion")))
# dev.off()
vcd::assoc(majukan_exp_sense_av_pass_chisq$observed[c(1, 3, 2), ], shade = TRUE, legend = legend_resbased(fontsize = 10), gp_labels = gpar(fontsize = 7.75), labeling_args = list(set_varnames = c(voice = "Voice", sense = "Senses")), set_labels = list(voice = c("AV", "PASS"), sense = c("advancing", "cause to happen earlier", "LIT. caused forward motion")))
#'
#'
#' # Analysis for *mundurkan*, *memundurkan*, *dimundurkan* {#mundurkan-all}
#'
#' ## Corpus data for *mundurkan*
#'
## ----mundurkan-load-sample, message = FALSE, warning = FALSE------------------------
mundurkan <- as_tibble(readRDS("mundurkan_BARE_all_data.rds")) %>%
filter(sense != "duplicate")
memundurkan <- as_tibble(readRDS("mundurkan_AV_all_data.rds")) %>%
filter(sense != "duplicate") %>%
select(-sense) %>%
rename(sense = sense_generic)
dimundurkan <- as_tibble(readRDS("mundurkan_PASS_all_data.rds"))
#'
## ----mundurkan-met-lit-sense-count--------------------------------------------------
mundurkan_met_lit_sense <- mundurkan %>%
count(sense, voice) %>%
mutate(node = "mundurkan") %>%
bind_rows(memundurkan %>%
count(sense) %>%
mutate(voice = "av", node = "memundurkan")) %>%
bind_rows(dimundurkan %>%
count(sense) %>%
mutate(voice = "pass", node = "dimundurkan")) %>%
mutate(sense_type = if_else(str_detect(sense, "^phys"), "lit", "met"))
mundurkan_met_lit_by_word <- mundurkan_met_lit_sense %>%
group_by(sense_type, node) %>%
tally(n) %>%
arrange(node) %>%
group_by(node) %>%
mutate(perc = round(n/sum(n) * 100, 2),
total = sum(n),
pbin = map_dbl(pmap(list(x = n, n = total), binom.test), "p.value"),
dec = if_else(pbin >= 0.05, "ns", "***"),
dec = if_else(pbin < 0.05, "*", dec),
dec = if_else(pbin < 0.01, "**", dec),
dec = if_else(pbin < 0.001, "***", dec))
#'
#'
## ----mundurkan-metaphoric-lit-sense-count-1-----------------------------------------
mundurkan_met_lit <- mundurkan %>%
filter(voice == "av") %>%
select(node, sense, voice) %>%
mutate(node = tolower(node))
memundurkan_met_lit <- memundurkan %>%
select(node, sense) %>%
mutate(node = tolower(node), voice = "av")
dimundurkan_met_lit <- dimundurkan %>%
select(node, sense) %>%
mutate(node = tolower(node), voice = "pass")
mundurkan_met_lit_all <- bind_rows(mundurkan_met_lit,
memundurkan_met_lit,
dimundurkan_met_lit) %>%
mutate(sense = replace(sense, sense == "retreat; retrospect", "change one's mind"),
sense = replace(sense, sense == "phys_move back", "LIT. caused backward motion"),
sense = as_factor(sense),
sense = fct_relevel(sense,
"temporal_postpone",
"withdraw s.o.",
"change one's mind",
"LIT. caused backward motion")) %>%
filter(node != "mundurkan")
mundurkan_met_lit_all_count <- mundurkan_met_lit_all %>%
count(sense) %>%
mutate(perc=n/sum(n)*100)
mundurkan_met_lit_all_count_by_voice <- mundurkan_met_lit_all %>%
count(sense, voice) %>%
group_by(voice) %>%
mutate(perc=n/sum(n)*100)
#'
## ----mundurkan-met-lit-stats, warning = FALSE, message = FALSE----------------------
mundurkan_met_lit_all_count_by_voice_mtx <- mundurkan_met_lit_all_count_by_voice %>%
ungroup() %>%
select(-perc) %>%
pivot_wider(names_from = voice,
values_from = n,
values_fill = 0L) %>%
data.frame(row.names = 1) %>%
as.matrix()
mundurkan_met_lit_all_chisq <- chisq.test(mundurkan_met_lit_all_count_by_voice_mtx)
mundurkan_met_lit_all_fye <- fisher.test(mundurkan_met_lit_all_count_by_voice_mtx)
mundurkan_met_lit_assocstats <- assocstats(mundurkan_met_lit_all_count_by_voice_mtx)
#'
#' Codes for [Figure \@ref(fig:figure6-mundurkan-met-lit-sense-plot)](#figure6-mundurkan-met-lit-sense-plot)
#'
## ----figure6-mundurkan-met-lit-sense-plot, fig.cap="Distribution of metaphoric and literal senses of *mundurkan* across AV and PASS"----
# PERCENTAGES-----
## FIGURE 6 ===========
fig6_df <- mundurkan_met_lit_all_count_by_voice %>% mutate(voice = toupper(voice), sense = as.character(sense), sense = replace(sense, sense=="temporal_postpone", 'postpone'), sense = factor(sense, levels = c("postpone", "withdraw s.o.", "change one's mind", "LIT. caused backward motion")))
fig6 <- fig6_df %>%
ggplot(aes(x = voice, y = perc, fill = sense)) +
geom_col(position = position_dodge(.9)) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(9, "YlGnBu")[7], RColorBrewer::brewer.pal(9, "YlGnBu")[4], RColorBrewer::brewer.pal(9, "YlGnBu")[2], RColorBrewer::brewer.pal(9, "YlGnBu")[1])) +
theme_bw() +
theme(legend.position = "top") +
geom_text(aes(label = paste("N=", n, sep = "")),
position = position_dodge(.9),
vjust = -.35, size = 3) +
labs(x = "Voice", y = "Percentages", fill = "Senses", caption = bquote(paste(italic(p)["Fisher Exacts; two-tailed"], .(if(mundurkan_met_lit_all_fye $p.value < 0.001) " < 0.001" else if(mundurkan_met_lit_all_fye$p.value < 0.01) " < 0.01" else if(mundurkan_met_lit_all_fye $p.value < 0.05) " < 0.05" else if(mundurkan_met_lit_all_fye $p.value >= 0.05) paste("=", round(mundurkan_met_lit_all_fye $p.value, 3))), "; Cramér's ", italic(V), "=", .(round(mundurkan_met_lit_assocstats$cramer, 3)))))
# Uncomment the following line to activate the code to save the image to the computer
# fig6 + ggsave("figs/figure-6.jpeg", width = 7, height = 5.5, units = "in", dpi = 600)
fig6
#'
#'
#'
#'
#'
#'
## ----figure7-mundurkan-met-lit-assocplot, fig.cap="Association plot between metaphoric and literal senses of *mundurkan* with AV and PASS.", fig.asp=.8----
## FIGURE 7 ============
mtx_tb <- mundurkan_met_lit_all_count_by_voice_mtx
rownames(mtx_tb)[c(1, 3)] <- c("postpone", "change one's mind")
names(dimnames(mtx_tb)) <- c("Sense", "Voice")
colnames(mtx_tb) <- toupper(colnames(mtx_tb))
# Uncomment the following three lines to activate the code to save the plot in computer
# png("figs/figure-7.jpeg", width = 7, height = 6, units = "in", res = 600)
# vcd::assoc(mtx_tb, shade = TRUE, gp_labels = gpar(fontsize = 7.5), legend = legend_resbased(fontsize = 10.5), labeling_args = list(set_varnames = c(Sense = "Senses")))
# dev.off()
vcd::assoc(mtx_tb, shade = TRUE, gp_labels = gpar(fontsize = 7.5), legend = legend_resbased(fontsize = 10.5), labeling_args = list(set_varnames = c(Sense = "Senses")))
#'
#'
#'
#' ## Experimental data for *mundurkan*
#'
#'
## ----mundurkan-exp-meta-lit-count---------------------------------------------------
mundurkan_exp_meta_lit_sense <- mundurkan_exp1 %>%
filter(clause_type=="declarative") %>%
count(sense, node, sort = T) %>% mutate(perc = round(n/sum(n)*100, 2)) %>%
bind_rows(memundurkan_exp1_sense_count %>% mutate(perc = round(n/sum(n)*100, 2))) %>%
bind_rows(dimundurkan_exp1_sense_count %>% mutate(perc = round(n/sum(n)*100, 2))) %>% arrange(node) %>%
mutate(sense_type = if_else(str_detect(sense, "^phys"), "lit", "met"))
mundurkan_exp_meta_lit_root <- mundurkan_exp1 %>%
# filter(clause_type=="declarative") %>%
count(sense, clause_type, node, sort = T) %>%
group_by(sense) %>%
mutate(perc = round(n/sum(n)*100, 2)) %>%
arrange(sense) %>%
ungroup()
mundurkan_exp_met_lit_by_word <- mundurkan_exp_meta_lit_sense %>%
group_by(node, sense_type) %>%
summarise(n=sum(n),perc=sum(perc), .groups = 'drop') %>%
group_by(node) %>%
mutate(total = sum(n),
pbin = map_dbl(pmap(list(x = n, n = total), binom.test), "p.value"),
dec = if_else(pbin >= 0.05, "ns", "***"),
dec = if_else(pbin < 0.05, "*", dec),
dec = if_else(pbin < 0.01, "**", dec),
dec = if_else(pbin < 0.001, "***", dec))
#'
#'
#'
## ----figure8-mundurkan-exp-metaphoric-lit-sense-plot, fig.cap="Distribution of metaphoric and literal senses of *mundurkan* in AV and PASS (sentence-production)", warning=FALSE----
## FIGURE 8 =========
mundurkan_exp_sense_av_pass <- bind_rows(memundurkan_exp1_sense_count,
dimundurkan_exp1_sense_count,
select(filter(mundurkan_exp1_declarative_sense_count_by_voice, voice == "av"), -voice)) %>%
mutate(voice = "pass",
voice = if_else(str_detect(node, "^di", negate = TRUE), "av", voice),
sense = replace(sense, sense == "temporal", "postpone")) %>%
filter(node != "mundurkan")
mundurkan_exp_met_lit_sense_av_pass_plotdf <- mundurkan_exp_sense_av_pass %>%
# filter(sense != "phys_motion") %>%
group_by(voice, sense) %>%
summarise(n = sum(n), .groups = 'drop') %>%
group_by(voice) %>%
mutate(perc = round(n/sum(n)*100, 2)) %>%
ungroup() %>%
mutate(sense = replace(sense, sense == "phys_motion", "LIT. caused backward motion"),
voice = fct_relevel(as.factor(voice), c("av", "pass")),
sense = fct_relevel(as.factor(sense), c("postpone", "withdraw s.o.", "deteriorate", "LIT. caused backward motion")))
mundurkan_exp_met_lit_sense_av_pass_chisq <- mundurkan_exp_met_lit_sense_av_pass_plotdf %>%
pivot_wider(-perc, names_from = voice, values_from = n, values_fill = 0) %>%
column_to_rownames('sense') %>%
as.matrix() %>%
chisq.test(correct = TRUE)
mundurkan_exp_met_lit_sense_av_pass_fisher <- fisher.test(mundurkan_exp_met_lit_sense_av_pass_chisq$observed)
mundurkan_exp_met_lit_sense_av_pass_cramer <- round(assocstats(mundurkan_exp_met_lit_sense_av_pass_chisq$observed)$cramer, 3)
fig8 <- mundurkan_exp_met_lit_sense_av_pass_plotdf %>%
ggplot(aes(x = toupper(voice), y = perc, fill = sense)) +
geom_col(position = position_dodge(.9)) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(9, "YlGnBu")[7],
RColorBrewer::brewer.pal(9, "YlGnBu")[4],
RColorBrewer::brewer.pal(9, "YlGnBu")[2],
RColorBrewer::brewer.pal(9, "YlGnBu")[1])) +
theme_bw() +
geom_text(aes(label = paste("N=", n, sep = "")), position = position_dodge(.9), vjust = -.35, size = 3) +
theme(legend.position = "top") +
labs(x = "Voice", y = "Percentages", fill = "Senses", caption = bquote(paste(italic(p)["Fisher Exacts; two-tailed"], .(if(mundurkan_exp_met_lit_sense_av_pass_fisher$p.value < 0.001) " < 0.001" else if(mundurkan_exp_met_lit_sense_av_pass_fisher$p.value < 0.01) " < 0.01" else if(mundurkan_exp_met_lit_sense_av_pass_fisher$p.value < 0.05) " < 0.05" else paste("=", round(mundurkan_exp_met_lit_sense_av_pass_fisher$p.value, 3))), "; Cramér's ", italic(V), "=", .(mundurkan_exp_met_lit_sense_av_pass_cramer))))
# Uncomment the following line to activate the code to save the image to computer
# fig8 + ggsave("figs/figure-8.jpeg", width = 7, height = 5.5, units = "in", dpi = 600)
fig8
#'
#'
## ----figure9-mundurkan-exp-met-lit-combined-assocplot, fig.cap="Association plot between metaphoric senses of *mundurkan* in AV and PASS from sentence-production experiment.", fig.asp=.775----
## FIGURE 9 ==========
mundurkan_exp_met_lit_assocplot_tb <- mundurkan_exp_met_lit_sense_av_pass_plotdf %>%
arrange(sense) %>%
pivot_wider(-perc, names_from = voice, values_from = n, values_fill = 0) %>%
data.frame(row.names = 1) %>%
as.matrix()
names(dimnames(mundurkan_exp_met_lit_assocplot_tb)) <- c("sense", "voice")
# Uncomment the following three lines to activate the code for saving the plot in computer:
# png("figs/figure-9.jpeg", width = 7, height = 6, units = "in", res = 600)
# vcd::assoc(mundurkan_exp_met_lit_assocplot_tb, shade = TRUE, legend = legend_resbased(fontsize = 10), gp_labels = gpar(fontsize = 7), labeling_args = list(set_varnames = c(voice = "Voice", sense = "Senses")), set_labels = list(voice = c("AV", "PASS")))
# dev.off()
vcd::assoc(mundurkan_exp_met_lit_assocplot_tb, shade = TRUE, legend = legend_resbased(fontsize = 10), gp_labels = gpar(fontsize = 7), labeling_args = list(set_varnames = c(voice = "Voice", sense = "Senses")), set_labels = list(voice = c("AV", "PASS")))
#'
#' # Analysis for *ajukan*, *mengajukan*, and *diajukan*
#'
## ----aju-data-load, message = FALSE, warning = FALSE--------------------------------
aju_root <- readRDS("aju_ROOT_all_data.rds")
aju_root_sense_count <- count(aju_root, sense, sort = TRUE)
aju_av <- readRDS("aju_AV_all_data.rds")
#'
#' In the corpus, the root *aju*^[The bound root *aju* appears to be a reflex of an old Austronesian form \**-a-tu* that expresses physical sense of 'forward, onwards; towards the hearer' [@blust_austronesian_2010]; see [this link](https://www.trussel2.com/ACD/acd-s_c2.htm#2170). We thank the anonymous reviewer for pointing this out to us.] occurs in total `r sum(aju_root_sense_count$n)` times: `r pull(filter(aju_root_sense_count, sense == "PROPER_NAME"), n)` of these are proper name, `r pull(filter(aju_root_sense_count, sense == "typo_mengajukan"), n)` is typo for the suffixed AV form *mengajukan*, and only the remaining `r pull(filter(aju_root_sense_count, sense == "advanced"), n)` tokens can be considered relevant. In all these relevant tokens, *aju* is used as modifier in a noun phrase meaning 'advanced' (e.g., *tim __aju__* '*advanced* team'), rather than as head-predicate that can have voice prefixes. Then, the AV form *mengaju* also occurred in the corpus, but they are all typos for *mengaku* 'to admit something' and *mengacu* 'to refer to something'. The search for the potential passive form *diaju* returned no hits in the corpus. These search results for the AV and PASS with *aju* converge with the zero results from the entry in KBBI. The conventional verbal morphological constructions for *aju* is the suffixed one with -*kan* that we used in the analyses.
#'
## ----ajukan-load-sample, message = FALSE, warning = FALSE---------------------------
ajukan <- tibble::as_tibble(readRDS("ajukan_BARE_sample_data.rds")) %>%
rename(voice = voice_type)
ajukan_cases <- nrow(ajukan)
mengajukan <- tibble::as_tibble(readRDS("ajukan_AV_sample_data.rds"))
diajukan <- tibble::as_tibble(readRDS("ajukan_PASS_sample_data.rds"))
#'
#'
## ----ajukan-voice-count-------------------------------------------------------------
ajukan_unclear_voice_id <- which(ajukan$voice == "blur")
ajukan_typo_voice_id <- which(ajukan$voice == "typo_di")
ajukan_typo_voice_df <- ajukan[ajukan_typo_voice_id, ]
ajukan <- ajukan %>%
filter(voice != "typo_di") %>%
mutate(voice = replace(voice, voice == "blur", "unclear"))
ajukan_voice_tb <- ajukan %>%
count(voice, sort = TRUE) %>%
mutate(perc = round((n/sum(n) * 100), 2))
#'
#'
## ----figure10-ajukan-voice-plot, fig.cap="Distribution of *ajukan* in different voice."----
## FIGURE 10 ============
aju_voice_count <- c(av = nrow(filter(mengajukan, subsense1 != "unclear")),
pass = nrow(diajukan),
uv = nrow(filter(ajukan, voice != "unclear", voice != "av")))
aju_voice_chisq <- chisq.test(aju_voice_count)
fig10 <- data.frame(voice = toupper(names(aju_voice_count)),
n = aju_voice_count,
row.names = NULL) %>%
ggplot(aes(x = voice, y = n, fill = voice)) +
geom_col() +
geom_text(aes(label = paste("N=", n, sep = "")), vjust = -.35, size = 3) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(11, "RdYlBu")[1],
RColorBrewer::brewer.pal(11, "RdYlBu")[8],
RColorBrewer::brewer.pal(11, "RdYlBu")[5])) +
theme_bw() +
theme(legend.position = 'none') +
labs(y = "Raw frequency", x = "Voice", caption = bquote(paste(italic(X)["goodness-of-fit"]^2, "=", .(round(aju_voice_chisq$statistic, 2)), "; ", italic(df), "=", .(aju_voice_chisq$parameter), "; ", italic(p)["two-tailed"], .(if(aju_voice_chisq$p.value < 0.001) " < 0.001"))))
# Uncomment the following line to activate the code to save the plot in computer
# fig10 + ggsave("figs/figure-10.jpeg", width = 7, height = 5.5, units = "in", dpi = 600)
fig10
#'
#'
## ----ajukan-core-sense-statistics---------------------------------------------------
# Chi-Square goodness-of-fit test of senses for *ajukan* in AV and PASS from the corpus
ajukan_av_pass_core_chisq <- chisq.test(aju_voice_count[names(aju_voice_count)!="uv"])
# Chi-Square goodness-of-fit test of senses for *ajukan* in AV and PASS from the experiment
ajukan_exp_av_pass_core_chisq <- chisq.test(c(nrow(mengajukan_exp1), nrow(diajukan_exp1)))
## Even if we run the statistics for the subsenses (put in the `sense` column) for the passive and active in the experimental data, there is no clear and more importantly strong preference for each subsense to each voice for *ajukan*. The core, generic sense of these subsenses is 'propose; put forward'. Run the following codes.
# join the AV and PASS data for *ajukan* from the experiment
ajukan_exp_av_pass_subsense_mtx <- matrix(c(mengajukan_exp1_subsense_count$n, diajukan_exp1_subsense_count$n), ncol = 2, byrow = FALSE, dimnames = list(subsense = c("file; submit", "propose", "nominate", "apply for"), voice = c("av", "pass")))
# run the fisher.test
ajukan_exp_av_pass_subsense_fye <- fisher.test(ajukan_exp_av_pass_subsense_mtx)
# the p-value is larger than the standard level of p < 0.05. Uncomment the following code to verify that the p-value is indeed NOT smaller than 0.05
# fisher.test(ajukan_exp_av_pass_subsense_mtx)$p.value < 0.05
# the Cramér's V is also small (i.e., the effect of different distribution is small). Uncomment the following code to see the results
# vcd::assocstats(ajukan_exp_av_pass_subsense_mtx)$cramer
# Uncomment the following code to see the association plot for the subsenses of *ajukan* across voice. They are all in grey shading.
# vcd::assoc(ajukan_exp_av_pass_subsense_mtx, shade = TRUE, legend = legend_resbased(fontsize = 10), gp_labels = gpar(fontsize = 7), labeling_args = list(set_varnames = c(voice = "Voice", subsense = "Sub-senses")), set_labels = list(voice = c("AV", "PASS")))
#'
#'
#' # Analysis for *undur*, *undurkan*, *mengundurkan*, *diundurkan*
#'
## ----undur-load-data, message=FALSE, warning=FALSE----------------------------------
# UNDUR------
undur <- readRDS("undur_ROOT_all_data.rds") %>%
select(-duplicate) %>%
mutate(function_of_node = replace(function_of_node, is.na(function_of_node),
"v-tr"),
function_of_node = replace(function_of_node,
function_of_node == "intransitive",
"v-intr"),
sense = replace(sense, sense == "temporal_postpone", "postpone"),
node = tolower(node)) %>%
filter(!typo, !sense %in% c("duplicate", "kind_of_animal"),
function_of_node != "nominal") %>%
as_tibble()
mengundur <- readRDS("undur_AV_all_data.rds") %>%
filter(!typo, sense != "duplicate") %>%
mutate(voice = "av",
sense = replace(sense, sense == "temporal_postpone", "postpone"),
node = tolower(node)) %>%
as_tibble() # all temporal 'postpone'
diundur <- readRDS("undur_PASS_sample_data.rds") %>%
filter(sense != "duplicate") %>%
mutate(voice = "pass",
sense = replace(sense, sense == "temporal_postpone", "postpone"),
node = tolower(node)) %>%
as_tibble() # all temporal 'postpone'
# UNDURKAN------
undurkan <- readRDS("undurkan_BARE_all_data.rds") %>%
as_tibble() %>%
mutate(sense = replace(sense, sense == "temporal_postpone", "postpone"),
node = tolower(node)) # low frequency; all AV
mengundurkan <- readRDS("undurkan_AV_sample_data.rds") %>%
mutate(voice = "av", sense = replace(sense, sense == "temporal_postpone", "postpone"),
node = tolower(node)) %>%
as_tibble() # vastly 'step down; bow out' in fixed verb phrase "mengundurkan diri"
diundurkan <- readRDS("undurkan_PASS_all_data.rds") %>%
filter(sense != "duplicate") %>%
mutate(voice = "pass",
sense = replace(sense, sense == "temporal_postpone", "postpone"),
node = tolower(node)) %>%
as_tibble() # all temporal
#'
## ----undur-undurkan-forms-count-----------------------------------------------------
undur_sense_allvoice <- undur %>%
filter(voice == "uv") %>%
select(node, voice, sense) %>%
bind_rows(mengundur %>% select(node, voice, sense)) %>%
bind_rows(diundur %>% select(node, voice, sense)) %>%
mutate(node = as.factor(node),
node = fct_relevel(node, "undur", "mengundur", "diundur"),
base = "undur")
undurkan_sense_allvoice <- undurkan %>%
filter(voice == "uv") %>%
select(node, voice, sense) %>%
bind_rows(mengundurkan %>% select(node, voice, sense)) %>%
bind_rows(diundurkan %>% select(node, voice, sense)) %>%
mutate(node = as.factor(node),
node = fct_relevel(node, "mengundurkan", "diundurkan"),
base = "undurkan")
undur_undurkan_forms <- bind_rows(undur_sense_allvoice, undurkan_sense_allvoice)
undur_undurkan_forms_count <- undur_undurkan_forms %>%
count(node, voice, sort = TRUE)
undur_undurkan_forms_chisq <- undur_undurkan_forms_count %>%
pivot_wider(names_from = voice,
values_from = n,
values_fill = 0) %>%
arrange(node) %>%
data.frame(row.names = 1) %>%
rowSums() %>%
chisq.test()
#'
## ----figure11-undur-undurkan-forms-plot, fig.cap="Distribution of voice for the metaphoric usages of the base *undur* and *undurkan*"----
# SPLIT BY BASE-----
## FIGURE 11 ============
undur_undurkan_forms_count_with_base <- undur_undurkan_forms_count %>%
mutate(voice = toupper(voice),
base = c("undurkan", "undur", "undur", "undurkan", "undur")) %>%
group_by(base) %>%
mutate(perc = round(n/sum(n)*100, 2))
fig11 <- undur_undurkan_forms_count %>%
mutate(voice = toupper(voice),
base = c("undurkan", "undur", "undur", "undurkan", "undur")) %>%
ggplot(aes(x = node, y = n, fill = voice)) +
geom_col(position = position_dodge(.9)) +
geom_text(aes(label = paste("N=", n, sep = "")), vjust = -.35, size = 3) +
scale_fill_manual(values = c(RColorBrewer::brewer.pal(11, "RdYlBu")[1], RColorBrewer::brewer.pal(11, "RdYlBu")[8], RColorBrewer::brewer.pal(11, "RdYlBu")[5])) +
theme_bw() +
facet_wrap(~base, scales = "free_x", labeller = labeller(base = c(undur = "base/root: UNDUR", undurkan = "base/root: UNDURKAN"))) +
theme(legend.position = "top", strip.text.x = element_text(face = "bold")) +
labs(fill = "Voice", x = "Verbs", y = "Raw frequency")
# Uncomment the following line to activate the code to save the plot in computer
# fig11 + ggsave("figs/figure-11.jpeg", width = 8, height = 5.5, units = "in", dpi = 600)
fig11
#'
#'
## ----undur-sense-allvoice-count-----------------------------------------------------
undur_sense_allvoice <- undur %>%
filter(voice == "uv") %>%
select(node, voice, sense) %>%
bind_rows(mengundur %>% select(node, voice, sense)) %>%
bind_rows(diundur %>% select(node, voice, sense))
undur_sense_allvoice_count <- undur_sense_allvoice %>%
count(voice, sense, sort = T)
undur_allvoice_count <- undur_sense_allvoice_count %>% group_by(voice) %>%
summarise(n=sum(n), .groups='drop') %>%
data.frame(row.names = 1)
# code to run the Chi-Square goodness-of-fit for distribution of voice types of *undur* (at the end of Section 5.4, i.e., in the paragraph below Figure 11).
undur_allvoice_chisq <- chisq.test(undur_allvoice_count)
#'
#'
## ----undur-postpone-sense-allvoice-chisq-goodness-of-fit----------------------------
# Code to run the Chi-Square goodness-of-fit for *undur* in AV and PASS. (Section 5.4.1 in the paper)
names(undur_sense_allvoice_count$n) <- undur_sense_allvoice_count$voice
undur_senses_allvoice_goodness_of_fit <- chisq.test(undur_sense_allvoice_count$n[names(undur_sense_allvoice_count$n)!="uv"])
#'
#'
#' [Figure \@ref(fig:figure11-undur-undurkan-forms-plot) above](#figure11-undur-undurkan-forms-plot) shows asymmetry in the frequency of occurrence of the words in certain voice morphologies. The suffixed AV *mengundurkan* (`r pull(filter(undur_undurkan_forms_count_with_base, node=='mengundurkan'), perc)`% of the total `r pull(filter(tally(undur_undurkan_forms_count_with_base, wt=n), base=='undurkan'), n)` tokens of the base *undurkan*) is much more frequent than the unsuffixed AV *mengundur* (`r pull(filter(undur_undurkan_forms_count_with_base, node=='mengundur'), perc)`% of the total `r pull(filter(tally(undur_undurkan_forms_count_with_base, wt=n), base=='undur'), n)` tokens of the base *undur*). The unsuffixed PASS *diundur* (`r pull(filter(undur_undurkan_forms_count_with_base, node=='diundur'), perc)`% of the total `r pull(filter(tally(undur_undurkan_forms_count_with_base, wt=n), base=='undur'), n)` tokens of the base *undur*) is much more frequent than the suffixed PASS *diundurkan* (`r pull(filter(undur_undurkan_forms_count_with_base, node=='diundurkan'), perc)`% of the total `r pull(filter(tally(undur_undurkan_forms_count_with_base, wt=n), base=='undurkan'), n)` tokens of the base *undurkan*). The UV form is significantly lower than expected by chance compared to other voice types for unsuffixed verbs based on the root *undur* (*X*^2^~goodness-of-fit~=`r round(undur_allvoice_chisq$statistic, 2)`; *df*=`r undur_allvoice_chisq$parameter`; *p*~two-tailed~`r if(undur_allvoice_chisq$p.value < 0.001) " < 0.001"`). For this reason, we only analysed the AV and PASS data for *undur* root (i.e. *mengundur* and *diundur*) and *undurkan* (*mengundurkan* and *diundurkan*). Similar stems are analysed in the experimental data.
#'
#'
#' ## *undur*
#'
#' The root *undur* in AV *mengundur* (N=`r pull(filter(undur_sense_allvoice_count, voice=='av'), n)`), UV *undur* (N=`r pull(filter(undur_sense_allvoice_count, voice=='uv'), n)`), and PASS *diundur* (N=`r pull(filter(undur_sense_allvoice_count, voice=='pass'), n)`) all conveys the 'postpone' sense. No variation of senses found across voice. *Undur* is thus meaning-preserving in the sample since its AV and PASS alternations preserve the same meaning. However, comparing the distribution of this sense in AV and PASS suggests that 'postpone' is significantly more frequent in PASS than in AV (*X*^2^~goodness-of-fit~=`r round(undur_senses_allvoice_goodness_of_fit$statistic, 2)`; *df*=`r undur_senses_allvoice_goodness_of_fit$parameter`; *p*~two-tailed~`r if(undur_senses_allvoice_goodness_of_fit$p.value < 0.001) " < 0.001"`), simply because the token frequency of the PASS is greater.
#'
## ----undur-exp-postpone-sense-allvoice-chisq-goodness-of-fit------------------------
# code for chi-square goodness-of-fit test for the EXPERIMENTAL data of *undur* in AV and PASS (Section 5.4.1)
undur_sense_allvoice_exp_goodness_of_fit <- chisq.test(c(pass = diundur_exp1_sense_count$n,
av = nrow(filter(mengundur_exp1, P_lu !="INTR", sense=="temporal"))))
# uncomment the code below to print the results
# undur_sense_allvoice_exp_goodness_of_fit
#'
#'
#' If we turn to the experimental data, all transitive occurrences of the AV *mengundur* (N=`r mengundur_exp1_sense_count$n[mengundur_exp1_sense_count$sense=='temporal']`)^[Note that `r nrow(filter(mengundur_exp1, P_lu =="INTR", sense=="phys_motion"))` out of `r nrow(mengundur_exp1)` tokens of *mengundur* in the elicitation data are intransitive, meaning 'step back', where the SUBJ is the mover/Actor.] and all the occurrences of the PASS *diundur* (N=`r diundur_exp1_sense_count$n`) express the 'postpone' sense; however, its distribution across these two voice types do not differ significantly (*X*^2^~goodness-of-fit~=`r round(chisq.test(c(diundur_exp1_sense_count$n, nrow(filter(mengundur_exp1, P_lu !="INTR", sense=="temporal"))))$statistic, 2)`; *df*=`r chisq.test(c(diundur_exp1_sense_count$n, nrow(filter(mengundur_exp1, P_lu !="INTR", sense=="temporal"))))$parameter`; *p*~two-tailed~=`r round(chisq.test(c(diundur_exp1_sense_count$n, nrow(filter(mengundur_exp1, P_lu !="INTR", sense=="temporal"))))$p.value, 3)`). This is finding that supports the meaning-preserving hypothesis in voice alternation.
#'
#' While predominantly in corpus sample and sentence-production *mengundur* and *diundur* express metaphoric meaning of 'postpone', remnant of the archaic physical meaning 'backward motion' is still produced in the elicitation experiment. There are `r nrow(filter(mengundur_exp1 , P_lu=='INTR', sense=="phys_motion"))` tokens and all are intransitive with *meN-* prefix (unlike the transitive metaphoric use of *undur* in AV and PASS):