Statistics & probability

Cooperative game Shapley value calculator from coalition values

Allocate normalized cooperative surplus using exact rational Shapley averages of all players’ marginal coalition contributions.

Your numbers

Integer from 1 through 10.
Exactly 2^n rational values, starting with empty coalition mask 0.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Allocate normalized cooperative surplus using exact rational Shapley averages of all players’ marginal coalition contributions.

THE FORMULAφ_i=Σ_{S⊆N\{i}} |S|!(n−|S|−1)!/n! · [v(S∪{i})−v(S)]; Σφ_i=v(N)−v(∅).

A worked example

The default symmetric three-player game has singleton value 1, pair value 3 and grand-coalition value 6. Every player receives exact Shapley value 2, summing to 6.

Good to know

1–10 players; exactly 2^n finite rational values in binary coalition-mask order, each within ±1000000 and bounded input/fraction growth. Empty baseline normalized and reported separately. All marginals enter exact sums; first 200 rows displayed. No missing-coalition imputation, core-membership guarantee, strategic equilibrium or automatic machine-learning explanation.

Allocate a cooperative surplus, not an equilibrium

A cooperative game supplies a value for every coalition of players. Its Shapley value allocates the grand-coalition surplus by averaging how much each player adds when players join in different orders. It is an allocation rule with explicit symmetry and marginal-contribution principles, not a prediction of how strategic players will negotiate.

This page requires the whole coalition-value table. It does not learn those values, fill missing entries or explain a black-box prediction without additional model calls. A precise allocation can only answer the game that was entered; disagreements about the economic or scientific meaning of coalition values are not resolved by the arithmetic.

Cooperative game Shapley value calculator from coalition values worked example222Player 1Player 2Player 3Symmetric game: 2 + 2 + 2 = 6
Scroll across to see the full diagram.
The default symmetric three-player game has singleton value 1, pair value 3 and grand-coalition value 6. Every player receives exact Shapley value 2, summing to 6.

Compare this with the Zero sum matrix game calculator with mixed strategies. Allocate total cooperative surplus by average marginal contributions over coalition formation; the matrix-game page finds adversarial mixed-strategy equilibria from player-by-action payoffs.

Encode coalitions using binary masks

Player one corresponds to the lowest bit, player two to the next bit, and so on. A coalition mask includes a player when that bit is one. For three players, masks zero through seven cover the empty set, all singletons and pairs, and the complete coalition in a fixed reproducible order.

The value list must therefore contain exactly two raised to the player count entries. Include the empty-coalition value first even when it is zero. Finite decimals and rational fractions are accepted as exact values within the input bounds; arbitrary symbolic expressions or exponential notation are outside the exact fraction parser.

Normalize the empty-coalition baseline

If the empty coalition already has a nonzero value, that baseline is not generated by any player’s marginal contribution. The calculator subtracts it from every coalition value before reporting normalized surplus, while displaying the original baseline separately. Marginal differences remain unchanged under this common shift.

Efficiency consequently means that the player allocations sum to the grand coalition’s value minus the empty coalition’s value. It does not mean that the baseline has secretly been distributed equally. To allocate an existing baseline through another convention, the game or the allocation policy would need additional explicit information beyond Shapley marginal differences.

Average over all possible joining orders

For a player joining after a particular predecessor coalition S, the marginal contribution is the value with that player minus the value without them. There are factorial size of S orders for arranging predecessors and factorial remaining size orders for followers. Dividing their product by n factorial gives that coalition’s Shapley weight.

The implementation sums those weighted differences exactly using rational arithmetic, rather than sampling random permutations. Every admissible predecessor coalition enters the total. The detailed display is capped at its first two hundred marginal rows to remain readable, but the reported marginal count and allocation include the entire supported game.

Check the symmetric three-player example

The default gives each singleton value one, each pair value three and the grand coalition value six, with an empty baseline of zero. Each player faces the same marginal opportunities by symmetry. Averaging their possible entry contributions produces exact value two for each of the three players.

The three allocations sum to six, matching the normalized grand surplus. That efficiency identity is checked with exact fractions, so a cancellation caused by rounded decimals is not used to justify the result. The example also shows why simply splitting singleton values or dividing pair values would ignore contributions arising when a player completes a larger coalition.

Interpret negative and dummy contributions

Negative allocations are allowed when a player has negative average marginal effect in the entered game. The rule does not impose nonnegative shares or an individual-rationality constraint. A dummy player is separately identified when every marginal contribution equals that player’s normalized singleton value, making its Shapley value equal that amount.

A null player is the special case with zero marginal contribution everywhere. Symmetric players receive the same allocation when the game gives them interchangeable contributions, but equal allocations alone do not prove the game is symmetric. Inspect coalition values and the marginal table before attaching a substantive interpretation to an apparently simple share.

What exactness does and does not guarantee

Exact rational summation removes sampling uncertainty from the supported allocation calculation. It does not guarantee that the Shapley allocation lies in the game’s core, that no coalition would object, or that a bargaining process will select it. Those are additional cooperative-game questions with their own feasibility conditions and interpretations.

Adding the same constant to every coalition must leave allocations unchanged, while adding two games must add their Shapley values. An independent implementation can enumerate all player permutations and average contributions directly for small games. These identities verify the allocation rule without turning an assumed coalition table into verified evidence about real cooperative behavior.

A few questions, answered

Does the player list include the empty coalition?

The value list does: mask zero is required, followed by every coalition in binary-mask order.

What happens to a nonzero empty baseline?

It is subtracted from all coalition values and reported separately; player allocations sum to grand value minus that baseline.

Are all marginal contributions computed?

Yes. All enter the exact sums, while only the first 200 detailed rows are displayed for readability.

Must the allocation lie in the core?

No. Shapley efficiency and symmetry do not guarantee core membership or a stable negotiated outcome.

Find your calculator

Start typing to explore the library.