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%" = pr_obj1,
"t = 2.5%" = pr_obj2,
"t = 5%" = pr_obj3) |>
compare() |>
print()
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%" = pr_obj1,
"t = 2.5%" = pr_obj2,
"t = 5%" = pr_obj3) |>
compare() |>
print(subset = c("自民", "公明", "立憲", "共産", "維新"))
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