Calculate the \(L^{(2)}\) scores.

## Usage

```
L2Scores(powerRelation, elements = powerRelation$elements)
L2Ranking(powerRelation)
lexcel2Scores(powerRelation, elements = powerRelation$elements)
lexcel2Ranking(powerRelation)
```

## Arguments

- powerRelation
A

`PowerRelation`

object created by`PowerRelation()`

or`as.PowerRelation()`

- elements
Vector of elements of which to calculate their scores. By default, the scores of all elements in

`powerRelation$elements`

are considered.

## Value

Score function returns a list of type `L2Scores`

and length of `powerRelation$elements`

(unless parameter `elements`

is specified).
Each index contains a matrix with `length(powerRelation$eqs)`

columns and `1 + length(powerRelation$elements)`

rows.

Ranking function returns corresponding `SocialRanking`

object.

## Details

Let \(N\) be a set of elements, \(\succsim \in \mathcal{T}(\mathcal{P})\) a power relation, and \(\Sigma_1 \succ \Sigma_2 \succ \dots \succ \Sigma_m\) its corresponding quotient order.

For an element \(i \in N\), construct a matrix \(M^\succsim_i\) with \(m\) columns and \(|N|\) rows. Whereas each column \(q\) represents an equivalence class, each row \(p\) corresponds to the coalition size.

$$(M^\succsim_i)_{p,q} = |\lbrace S \in \Sigma_q: |S| = p \text{ and } i \in S\rbrace|$$

Given two elements \(i, j \in N\), \(L^{(2)}\) then ranks
\(i\) *strictly above* \(j\) if there is some row
\(p^0 \in \lbrace 1, \dots, |N| \rbrace\) and column
\(q^0 \in \lbrace 1, \dots, m \rbrace\) such that

\(\sum_{p = 1}^{|N|} (M^\succsim_i)_{p,q} = \sum_{p = 1}^{|N|} (M^\succsim_j)_{p,q}\text{ for all } q < q^0\),

\(\begin{cases} \text{(i)\hphantom{i} either } & \sum_{p=1}^{|N|} (M^\succsim_i)_{p,q^0} > \sum_{p=1}^{|N|} (M^\succsim_j)_{p,q^0}\\[5pt] \text{(ii) or } & (M^\succsim_i)_{p^0,q^0} > (M^\succsim_j)_{p^0,q^0} \text{ and } (M^\succsim_i)_{p,q^0} = (M^\succsim_j)_{p,q^0} \text{ for all } p < p^0 \end{cases}\)

Note that the conditions are very similar to `L1Ranking()`

, with the difference that condition 3.(i)
also ranks an element over another if they simply appear more often in an equivalence class, regardless of coalition size.
This implies that a row \(p^0\) for condition 3.(ii) to be satisfied may not have to exist.

## Example

Let \(N = \lbrace 1, 2, 3, 4 \rbrace\) and \(\succsim: (123 \sim 12 \sim 13 \sim 14 \sim 2 \sim 4) \succ S\), where \(S\) is every other coalition not present in the first equivalence class. From this, we get the following four matrices:

$$ M^\succsim_1 = \begin{bmatrix} 0 & 1\\ 3 & 0\\ 1 & 2\\ 0 & 1 \end{bmatrix} M^\succsim_2 = \begin{bmatrix} 1 & 0\\ 1 & 2\\ 1 & 2\\ 0 & 1 \end{bmatrix} M^\succsim_3 = \begin{bmatrix} 0 & 1\\ 1 & 2\\ 1 & 2\\ 0 & 1 \end{bmatrix} M^\succsim_4 = \begin{bmatrix} 1 & 0\\ 1 & 2\\ 0 & 3\\ 0 & 1 \end{bmatrix} $$

For the sums in column 1, we get

$$\begin{aligned}\sum_{p=1}^{4} (M^\succsim_1)_{p,1} &= 4,\\\sum_{p=1}^{4} (M^\succsim_2)_{p,1} &= 3,\\\sum_{p=1}^{4} (M^\succsim_3)_{p,1} = \sum_{p=1}^{4} (M^\succsim_4)_{p,1} &= 2\end{aligned}.$$

This immediately puts \(1\) above all other elements and \(2\) above \(3\) and \(4\) according to the \(L^{(2)}\). \(L^{(1)}\) would in this case prefer \(2\) over \(1\), simply because \(2\) appears once in a coalition of size 1 and \(1\) doesn't.

Since the column sum for \(3\) and \(4\) is the same, we can next evaluate if the individual row values are also the same. Here, since \((M^\succsim_4)_{1,1} > (M^\succsim_3)_{1,1}\), this gives an edge of element \(4\) over \(3\).

Note that, if the column was identical for \(3\) and \(4\), we would go to the next column and repeat the process. Elements are only then considered indifferent from each other, if the entire matrix is identical between the two.

## Alterations

The matrices as described above and in Béal S, Rémila E, Solal P (2022).
“Lexicographic solutions for coalitional rankings based on individual and collective performances.”
*Journal of Mathematical Economics*, **102**, 102738.
can be investigated with the `L1Scores()`

function.

For less complexity, another row is prepended to the matrix showing the sum of each column. Through this, a simple \(L^{(1)}\) comparison can be applied.

## Aliases

For better discoverability, `lexcel2Scores()`

and `lexcel2Ranking()`

serve as aliases for `L2Scores()`

and `L2Ranking()`

, respectively.

## References

Algaba E, Moretti S, Rémila E, Solal P (2021).
“Lexicographic solutions for coalitional rankings.”
*Social Choice and Welfare*, **57**(4), 1--33.

## See also

Other ranking solution functions:
`L1Scores()`

,
`LPSScores()`

,
`LPScores()`

,
`copelandScores()`

,
`cumulativeScores()`

,
`kramerSimpsonScores()`

,
`lexcelScores()`

,
`ordinalBanzhafScores()`

## Examples

```
pr <- as.PowerRelation("123 ~ 12 ~ 13 ~ 14 ~ 2 ~ 4")
pr <- appendMissingCoalitions(pr)
scores <- L2Scores(pr)
scores$`1`
#> [,1] [,2]
#> [1,] 4 4
#> [2,] 0 1
#> [3,] 3 0
#> [4,] 1 2
#> [5,] 0 1
# [,1] [,2]
# [1,] 0 1
# [2,] 3 0
# [3,] 1 2
# [3,] 0 1
L2Ranking(pr)
#> 1 > 2 > 4 > 3
# 1 > 2 > 4 > 3
L1Ranking(pr)
#> 2 > 4 > 1 > 3
# 2 > 4 > 1 > 3
```