Comparison multiple prcalc, prcalc_index, or prcalc_decomposition objects.

Description

Comparison multiple prcalc, prcalc_index, or prcalc_decomposition objects.

Usage

compare(x, ...)

## S3 method for class 'list'
compare(x, prop = FALSE, ...)

Arguments

x a list. All elements in the list must be prcalc, prcalc_index, or prcalc_decomposition objects.
Ignored
prop Default is FALSE.

Value

A prcalc_compare, prcalc_index_compare, or prcalc_decomposition_compare object

Examples

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()
            ID                         Index   t = 0% t = 2.5%  t = 5%
1       dhondt                       D’Hondt 1.116833  1.13833 1.15073
2       monroe                        Monroe 0.018918  0.04465 0.07028
3       maxdev    Maximum Absolute Deviation 0.010461  0.02626 0.04626
4     mm_ratio                 Max-Min ratio      Inf      Inf     Inf
5          rae                           Rae 0.004664  0.01078 0.01547
6           lh             Loosemore & Hanby 0.030315  0.07004 0.10052
7      grofman                       Grofman 0.011677  0.02698 0.03872
8     lijphart                      Lijphart 0.004069  0.02407 0.03407
9    gallagher                     Gallagher 0.014609  0.03448 0.05427
10 g_gallagher         Generalized Gallagher 0.014609  0.03448 0.05427
11       gatev                         Gatev 0.032939  0.07576 0.11690
12    ryabtsev                      Ryabtsev 0.023298  0.05365 0.08295
13      szalai                        Szalai 0.555712  0.68047 0.73470
14    w_szalai               Weighted Szalai 0.090661  0.17223 0.23070
15          ap          Aleskerov & Platonov 1.042141  1.08443 1.10490
16        gini                          Gini 0.036069  0.08943 0.13750
17    atkinson                      Atkinson 1.000000  1.00000 1.00000
18          sl                  Sainte-Laguë 0.018466  0.06389 0.11313
19          cs                 Cox & Shugart 1.033646  1.11513 1.17257
20      farina                        Farina 0.046282  0.09017 0.14105
21      ortona                        Ortona 0.046909  0.10838 0.15555
22          cd          Cosine Dissimilarity 0.000867  0.00329 0.00805
23          rr Lebeda’s RR (Mixture D’Hondt) 0.104611  0.12152 0.13099
24         arr                  Lebeda’s ARR 0.008047  0.00935 0.01008
25         srr                  Lebeda’s SRR 0.041482  0.04284 0.05664
26        wdrr                 Lebeda’s WDRR 0.055081  0.08720 0.11068
27          kl     Kullback-Leibler Surprise 0.016431  0.05936 0.10657
28          lr    Likelihood Ratio Statistic      Inf      Inf     Inf
29       chisq                   Chi Squared 0.004225  0.00852 0.01115
30   hellinger            Hellinger Distance 0.087758  0.16905 0.22747
31          ad              alpha-Divergence 0.009233  0.03194 0.05656