Given a game, this function computes its Shapley value.
Usage
shapleyvalue(v, binary = FALSE)
Value
The Shapley value of the game, as a vector.
Arguments
v
A characteristic function, as a vector.
binary
A logical value. By default, binary=FALSE. Should be set to TRUE if v is introduced in binary order instead of lexicographic order.
Details
Given \(v\in G^N\), the Shapley value of each player \(i \in N\) can be defined as
$$Sh_{i}(v) = \sum_{S \subset N \setminus \{i\}} \frac{s!(n-s-1)!}{n!} (v(S \cup \{i\})-v(S)).$$
It is also possible to compute it as
$$Sh_{i}(v) = \sum_{\emptyset \neq S \subset N} M_{i,S} v(S),$$
where \(M_{i,S} = \frac{(s-1)!(n-s)!}{n!}\) if \(i \in S\) and \(M_{i,S} = -\frac{s!(n-s-1)!}{n!}\) if \(i \notin S\).
References
Le Creurer, I. J., Mirás Calvo, M. A., Núñez Lugilde, I., Quinteiro Sandomingo, C., & Sánchez Rodríguez, E. (2024). On the computation of the Shapley value and the random arrival rule. Available at https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4293746.
Shapley, L. S. (1953). A value for n-person games. Contribution to the Theory of Games, 2.