-
Notifications
You must be signed in to change notification settings - Fork 0
/
arb-cal.qmd
36 lines (29 loc) · 1.36 KB
/
arb-cal.qmd
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
---
title: Implementation for Measuring the Arbitrariness of Conventions
authors:
- name: YAMAMOTO, Takanori
date: 2024-10-10
bibliography: references.bib
---
Conventions can admit a degree of arbitrariness. @oconnor2020measuring proposed a measure of the degree of arbitrariness. The program here is a trial implementation of it. The program code files are in src directory.
ja: 慣例は恣意性の程度を認めることができる。@oconnor2020measuring は, その恣意性の度合いを測る尺度を提案した。ここのプログラムは, それを試しに実装したものある。プログラムコードのファイルは, srcディレクトリに入っている。
```{R}
# Here, we measure the degree of arbitrariness of conventions
# A function to calculate entropy
#| label: arbitrariness-calculator
entropy <- function(probabilities) {
# Calculate the information content I(x_i)
information_content <- -log2(probabilities)
# Calculate the entropy H(x)
entropy_value <- sum(probabilities * information_content)
return(entropy_value)
}
```
```{R}
#| label: sample-param
# Probabilities of each convention, basin of attraction
# Below is an input example, with the basin of attraction from the author's simulation.
probabilities <- c(0.113709, 0.33434, 0.185575, 0.166355, 0.200022)
entropy_value <- entropy(probabilities)
print(entropy_value)
```