I am working to implement a model in this book - http://www.mbmlbook.com, specifically, the two player TrueSkill algorithm described in Chapter 3. My initial attempt at this was:

```
data {
int<lower=0,upper=1> JWin;
}
parameters {
real JSkill;
real FSkill;
real JPerf;
real FPerf;
}
model {
JSkill ~ normal(120, 40);
FSkill ~ normal(100, 5);
JPerf ~ normal(JSkill,5);
FPerf ~ normal(FSkill, 5);
if (JPerf > FPerf)
{
JWin ~ bernoulli(1.0);
}else{
JWin ~ bernoulli(0.0);
}
}
```

I also tried changing the model block to avoid the use of if expressions

```
model {
JSkill ~ normal(120, 40);
FSkill ~ normal(100, 5);
JPerf ~ normal(JSkill,5);
FPerf ~ normal(FSkill, 5);
JWin ~ bernoulli(JPerf > FPerf);
}
```

But neither appeared to work. The observed data did not seem to influence the posterior of the parameters. After trying a few things and changing the model block to:

```
model {
real p = JPerf > FPerf;
JSkill ~ normal(120, 40);
FSkill ~ normal(100, 5);
JPerf ~ normal(JSkill, 5);
FPerf ~ normal(FSkill, 5);
JWin ~ bernoulli(p);
}
```

it seems to be working as expected. I am curious as to why these model blocks would behave differently. I am also curious if anyone has an opinion about whether Stan is an appropriate tool to implement this type of model. The only other discussion I have found about this was from a while ago on the stans-users google group.