Error for multinomial distribution

Hi,

I am using multinomial distribution for my data and model,

In my model, I use nextstate[i,] ~ multinomial(prob).

I always have a note saying that: “No matches for: Available argument signatures for multinomial: real return type required for probability function”.

however, I have no idea how to fix it, can someone help with this? Thank you.

My model is pasted as follows:

``````data{//input data

int<lower = 1> N; //nb data row
int<lower = 1> S; //nb of states
real times[N]; //time point
int currentstate[N]; //current state
real nextstate[N, S];//next state matrix
}

parameters{
matrix[S, S] Vmatrix; //from is row; to is collum

}

transformed parameters {
matrix[S,S] Vmatrix_trans;
Vmatrix_trans = Vmatrix;
Vmatrix_trans[5, ] = [0,0,0,0,0];
}

model{
matrix[S, S] ProbTrans;
real prob[S];

for(i in 1:N){
ProbTrans = matrix_exp(times[i]*Vmatrix_trans);
prob = to_array_1d(ProbTrans[currentstate[i], ]);
nextstate[i,] ~ multinomial(prob);
}

//priors ...
}``````

The multinomial distribution is only defined for integer outcomes, but you’ve declared `nextstate` as a `real`.

Try changing the data definition to `int nextstate[N, S]`