# Bradley-Terry model for teams

Hi,

I have the following working Bradley-Terry model for single players

``````data {
int<lower=1> n_games;
int<lower=2> n_players;
int<lower=1, upper=n_players> player_id[n_games];
int<lower=1, upper=n_players> opponent_id[n_games];
int<lower=0> n_points_won[n_games];
int<lower=11> n_points[n_games];
}

parameters {
vector[n_players - 1] raw_lambda;
}

transformed parameters {
vector[n_players] lambda = append_row(0, raw_lambda);
vector<lower=0, upper=1>[n_games] phi = inv_logit(lambda[player_id] - lambda[opponent_id]);
}

model {
raw_lambda ~ normal(0, 2);
n_points_won ~ binomial(n_points, phi);
}
``````

Inspired by this paper I want to create a team-version of the above code. Each team consists of 2 players.
The paper assumes that the `lambda` of a team is simply the sum of the `lambda` of the players in that particular team. If I am not mistaken, Algorithm 2 in the paper is nothing special that can’t be reproduced using Stan.

If so, would the team-version look like below?

``````data {
int<lower=1> n_games;
int<lower=4> n_players;
int<lower=1, upper=n_players> player_id_1[n_games];
int<lower=1, upper=n_players> player_id_2[n_games];
int<lower=1, upper=n_players> opponent_id_1[n_games];
int<lower=1, upper=n_players> opponent_id_2[n_games];
int<lower=0> n_points_won[n_games];
int<lower=11> n_points[n_games];
}

parameters {
vector[n_players - 1] raw_lambda;
}

transformed parameters {
vector[n_players] lambda = append_row(0, raw_lambda);
vector<lower=0, upper=1>[n_games] phi = inv_logit(
lambda[player_id_1] + lambda[player_id_2] - lambda[opponent_id_1] - lambda[opponent_id_2]
);
}

model {
raw_lambda ~ normal(0, 2);
n_points_won ~ binomial(n_points, phi);
}
``````

This looks like the model you desire. I don’t immediately grasp why you fix the lambda of the first player to be zero–what if the first player turns out to be one of the best (or worst) players in the dataset? Why not estimate independent lambdas for every player?

Note that in the team case, you might want to consider:

1. Whether the lambdas of players on the same team are really additive. Additivity says that a team composed of a really good player and a really bad player should be evenly matched against a team of two mediocre players. But one can readily imagine cases where one really good player can consistently win against two mediocre players (e.g. chess) or where one really bad player makes it impossible to win no matter how good the other player is (e.g. ice dancing).
2. Whether overdispersion is more likely in the team case, for example if the quality of a team consisting of 2 players is determined by how these players complement one another, and not just by their skill levels in isolation.