This is also wrong, but in the more subtle way. I am counting the same data twice. The correct answer is this:
data {
int<lower=0> n_nn;
int<lower=0> n_pn;
int<lower=0> n_pp;
int<lower=0> n_np;
}
transformed data {
int nd[4];
nd[1] = n_nn;
nd[2] = n_pn;
nd[3] = n_np;
nd[4] = n_pp;
}
parameters {
real<lower=0, upper=1> pA;
real<lower=0, upper=1> pB;
}
transformed parameters {
simplex[4] s;
s[1] = (1-pA) * (1-pB);
s[2] = pA * (1-pB);
s[3] = pB * (1-pA);
s[4] = pA * pB;
}
model {
nd ~ multinomial(s);
}
@DouglasBoubert your answer is 100% correct, simple and beautiful. For my further work I need a form where I can put further constraints, since the model I work on has a third event, âTâ, which manifests itself only with counts on n_pp. This is where this seems more useful.