# Ordinal Banzhaf

`ordinalBanzhafScores.Rd`

Calculate the Ordinal Banzhaf scores, the number of positive and negative marginal contributions.

`ordinalBanzhafRanking()`

returns the corresponding ranking.

## Arguments

- powerRelation
A

`PowerRelation`

object created by`newPowerRelation()`

## Value

Score function returns list of class type `OrdinalBanzhafScores`

and length of `powerRelation$elements`

.
Each index contains a vector of two numbers, the number of positive and the number of negative marginal contributions.
Those two numbers summed together gives us the actual ordinal Banzhaf score.

Ranking function returns corresponding `SocialRankingSolution`

object.

## Details

Inspired by the Banzhaf index (Banzhaf III 1964) , the Ordinal Banzhaf determines the score of element \(i\) by adding the amount of coalitions \(S \subseteq N \setminus \lbrace i \rbrace\) its contribution impacts positively (\(S \cup \lbrace i \rbrace \succ S\)) and subtracting the amount of coalitions where its contribution had a negative impact (\(S \succ S \cup \lbrace i \rbrace\))(Khani et al. 2019) .

## References

Khani H, Moretti S, Öztürk M (2019).
“An ordinal banzhaf index for social ranking.”
In *28th International Joint Conference on Artificial Intelligence (IJCAI 2019)*, 378--384.

Banzhaf III JF (1964).
“Weighted voting doesn't work: A mathematical analysis.”
*Rutgers L. Rev.*, **19**, 317.

## See also

Other score vector functions:
`copelandScores()`

,
`cumulativeScores()`

,
`kramerSimpsonScores()`

,
`lexcelScores()`

## Examples

```
# 12 > (2 ~ {}) > 1
pr <- newPowerRelation(c(1,2), ">", 2, "~", c(), ">", 1)
# Player 1 contributes positively to {2}
# Player 1 contributes negatively to {empty set}
# Therefore player 1 has a score of 1 - 1 = 0
#
# Player 2 contributes positively to {1}
# Player 2 does NOT have an impact on {empty set}
# Therefore player 2 has a score of 1 - 0 = 0
# `1` = c(1, -1)
# `2` = c(1, 0)
ordinalBanzhafScores(pr)
#> $`1`
#> [1] 1 -1
#>
#> $`2`
#> [1] 1 0
#>
#> attr(,"class")
#> [1] "OrdinalBanzhafScores"
# 1 > 2
ordinalBanzhafRanking(pr)
#> 2 > 1
```