MyNixOS website logo
Description

Social Ranking Solutions for Power Relations on Coalitions.

The notion of power index has been widely used in literature to evaluate the influence of individual players (e.g., voters, political parties, nations, stockholders, etc.) involved in a collective decision situation like an electoral system, a parliament, a council, a management board, etc., where players may form coalitions. Traditionally this ranking is determined through numerical evaluation. More often than not however only ordinal data between coalitions is known. The package 'socialranking' offers a set of solutions to rank players based on a transitive ranking between coalitions, including through CP-Majority, ordinal Banzhaf or lexicographic excellence solution summarized by Tahar Allouche, Bruno Escoffier, Stefano Moretti and Meltem Öztürk (2020, <doi:10.24963/ijcai.2020/3>).

socialranking

Codecov testcoverage CRANstatus

The package socialranking offers functions to represent ordinal information of coalitions and calculate the power relation between elements or players.

Installation

Install the package directly from CRAN with:

install.packages("socialranking")

You can also install the development version of socialranking from GitHub with:

# install.packages("devtools")
devtools::install_github("jassler/socialranking")

Usage

The package socialranking offers functions to represent ordinal information of coalitions and calculate the power relation between elements or players.

Once installed, call library(socialranking) to load the package into your current environment.

PowerRelation() and as.PowerRelation() creates a PowerRelation object. createPowerset() is a convenient function to generate a PowerRelation() or as.PowerRelation() function call for all possible coalitions.

library(socialranking)
if(interactive()) {
  createPowerset(1:3, copyToClipboard = TRUE)
}

# pasted, rearranged, adjusted comparators
as.PowerRelation("
  123
  > 12
  ~ 13
  > 2
  ~ 23
  > 1
  > 3
")
#> 123 > (12 ~ 13) > (2 ~ 23) > 1 > 3

# equivalent
pr <- as.PowerRelation(
  list(c(1,2,3), c(1,2), c(1,3), c(2), c(2,3), c(1), c(3)),
  comparators = c(">", "~", ">", "~", ">", ">")
)

# equivalent
pr <- as.PowerRelation("123 > 12 ~ 13 > 2 ~ 23 > 1 > 3")
pr
#> 123 > (12 ~ 13) > (2 ~ 23) > 1 > 3

pr$elements
#> [1] 1 2 3
pr$eqs[[2]]
#> [[1]]
#> [1] 1 2
#> 
#> [[2]]
#> [1] 1 3

The functions used to analyze power relations can be grouped into comparison functions, score functions and ranking solutions. Ranking solutions produce a SocialRankingSolution object.

Comparison FunctionsScore FunctionsRanking Solutions
dominates()
cumulativelyDominates()cumulativeScores()
cpMajorityComparison()^1copelandScores()copelandRanking()
kramerSimpsonScores()kramerSimpsonRanking()
ordinalBanzhafScores()ordinalBanzhafRanking()
lexcelScores()lexcelRanking()
dualLexcelRanking()
L1Scores()L1Ranking()
LPScores()LPRanking()
LPSScores()LPSRanking()

^1 cpMajorityComparisonScore() is a faster alternative to cpMajorityComparison(), but it produces less data.

dominates(pr, 1, 2)
#> [1] FALSE

copelandRanking(pr)
#> 1 ~ 2 > 3

lexcelScores(pr, 1)
#> $`1`
#> [1] 1 2 0 1 0
#> 
#> attr(,"class")
#> [1] "LexcelScores"

PowerRelation objects can be turned into relations objects from the relations package using powerRelationMatrix() or as.relation().

Use browseVignettes("socialranking") for further information.

License

This package is licensed under GPL-3.

Metadata

Version

1.2.0

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows