# Dixons-Coles with over/unders

Hi,

I’m playing around with the dixons-coles football model and trying to get parameters given not only the score, but the probability of over/under 2.5 goals before the game began. My hope is then to replace the actual score of the game with the probability of the home/away/draw outcomes. I’m struggling to understand why the over/under 2.5 goals isn’t really having any affect on the outputs. Code presented below:

``````functions {
real tau(int x, int y, real rho, real mu1, real mu2) {

if (x == 0 && y == 0)
adj = 1 - (mu1 * mu2 * rho);
else if (x == 0 && y == 1)
adj = 1 + (mu1 * rho);
else if (x == 1 && y == 0)
adj = 1 + (mu2 * rho);
else if (x == 1 && y == 1)
else

}

real dixon_coles_log(int[] goals, real rho, real mu1, real mu2) {
int home;
int away;
real prob;

home = goals;
away = goals;

prob = poisson_lpmf(home | mu1) + poisson_lpmf(away | mu2) + log(tau(home, away, rho, mu1, mu2));
return prob;
}

real under_three_log(real under_prob_target,real mu1, real mu2, real rho){
real under_prob = 0;
int goals;

for(hg in 0:2){
for(ag in 0:2){
if( (hg+ag) < 4 ){
goals = hg;
goals = ag;
under_prob = under_prob + exp(  dixon_coles_log(goals,rho, mu1, mu2));
}
}
}
return (under_prob);
}

}

data {
//int<lower=0> N;
//vector[N] y;
real under_prob_log;
int home_goals;
int away_goals;
}

// The parameters accepted by the model. Our model
// accepts two parameters 'mu' and 'sigma'.
parameters {
real <lower=0> mu1;
real <lower=0> mu2;
real rho;
}

// The model to be estimated. We model the output
// 'y' to be normally distributed with mean 'mu'
// and standard deviation 'sigma'.
model {
//y ~ normal(mu, sigma);
int score;

mu1 ~ normal(0, 1);
mu2 ~ normal(0, 1);
rho ~ normal(0, 1);

score = home_goals;
score = away_goals;

under_prob_log ~ under_three_log(mu1,mu2,rho);
score ~ dixon_coles(rho, mu1, mu2);
}

generated quantities{

int score;

score = home_goals;
score = away_goals;