library(PRcalc)
data(jp_upper_2019)
pr_obj1 <- prcalc(jp_upper_2019, m = 50, method = "dt")
pr_obj2 <- prcalc(jp_upper_2019, m = 50, method = "dt", threshold = 0.025)
pr_obj3 <- prcalc(jp_upper_2019, m = 50, method = "dt", threshold = 0.05)
compare(list("t = 0%" = pr_obj1, "t = 2.5%" = pr_obj2, "t = 5%" = pr_obj3))
Party t = 0% t = 2.5% t = 5%
1 自民 18 19 20
2 公明 7 7 7
3 立憲 8 9 9
4 維新 5 5 5
5 共産 5 5 5
6 国民 3 3 4
7 れいわ 2 2 0
8 社民 1 0 0
9 N国 1 0 0
10 安楽死 0 0 0
11 幸福 0 0 0
12 オリーブ 0 0 0
13 労働者 0 0 0
list("t = 0%" = index(pr_obj1),
"t = 2.5%" = index(pr_obj2),
"t = 5%" = index(pr_obj3)) |>
compare() |>
print(subset = c("lh", "gallagher", "rae", "dhondt", "ad"),
hide_id = TRUE)
Index t = 0% t = 2.5% t = 5%
1 D’Hondt 1.11683 1.1383 1.1507
2 Rae 0.00466 0.0108 0.0155
3 Loosemore & Hanby 0.03032 0.0700 0.1005
4 Gallagher 0.01461 0.0345 0.0543
5 alpha-Divergence 0.00923 0.0319 0.0566