-
Notifications
You must be signed in to change notification settings - Fork 1
/
gini_hDAO
47 lines (36 loc) · 1.46 KB
/
gini_hDAO
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
# Gini coefficient of hDAO distribution
library(pins)
library(tidyverse)
library(REAT)
# Register Board for data pull
board_register("https://raw.githubusercontent.com/predictcrypto/pins/master/","pins_repo")
#### Visualize Stats ####
# hDAO Distribution
hdao_holders <- pin_get("hdao_holders", "pins_repo")
# Exclude KT1 wallets
# first add initials
hdao_holders = mutate(hdao_holders, start = substr(address, 1, 3))
# filter out those that start with KT1 now
hdao_holders = subset(hdao_holders, start != 'KT1')
# arrange by largest values first
hdao_holders = arrange(hdao_holders, desc(hdao_value))
# Calculate gini coefficient:
gini(hdao_holders$hdao_value)
# Plot lorenz curve
gini(hdao_holders$hdao_value, lc=T, lcg=T)
par(new=TRUE)
barplot(arrange(hdao_holders, hdao_value)$hdao_value,yaxt='n',border='orange')
# Test cutting off at minimum of 10 hDAO:
# Calculate gini coefficient:
gini(filter(hdao_holders,hdao_value > 10)$hdao_value)
# Plot lorenz curve
gini(filter(hdao_holders,hdao_value > 10)$hdao_value, lc=T, lcg=T)
par(new=TRUE)
barplot(arrange(filter(hdao_holders,hdao_value > 10), hdao_value)$hdao_value,yaxt='n',border='orange')
# Test cutting off at minimum of 100 hDAO:
# Calculate gini coefficient:
gini(filter(hdao_holders,hdao_value > 100)$hdao_value)
# Plot lorenz curve
gini(filter(hdao_holders,hdao_value > 100)$hdao_value, lc=T, lcg=T)
par(new=TRUE)
barplot(arrange(filter(hdao_holders,hdao_value > 100), hdao_value)$hdao_value,yaxt='n',border='orange')