Hi all,

I have the following model

```
data {
int<lower=1> n_matches; // number of matchres
int<lower=1> n_players; // number of players
int<lower=1, upper=n_players> player_id[n_matches]; // player id
int<lower=1, upper=n_players> opponent_id[n_matches]; // opponent id
int<lower=0, upper=1> won[n_matches]; // win or loss
}
parameters {
real<lower=0, upper=1> p[n_players];
}
model {
// likelihood
for (match in 1:n_matches) {
won[match] ~ bernoulli(custom_function(p[player_id[match]]));
}
}
```

How can I insert the constraint that the sum of `p[player_id[match]]`

and `p[opponent_id[match]]`

should be equal to 1?

I tried the below:

```
model {
real custom_function_p;
for (match in 1:n_matches) {
custom_fuction_p = custom_function(p[player_id[match]]);
p[opponent_id[match]] = 1.0 - p[player_id[match]];
won[match] ~ bernoulli(custom_function_p);
}
```

But this yields the following error:

Cannot assign to global variable āpā declared in previous blocks.

I also tried this without result:

```
model {
for (match in 1:n_matches) {
p[player_id[match]] + p[opponent_id[match]] ~ normal(1, 0);
won[match] ~ bernoulli(custom_function_p);
}
```

Resulting in

Exception: normal_lpdf: Scale parameter is 0, but must be positive!

Any advice?