I am not sure How Stan caculates multinomial distribution.

I did not know the multinomial distribution, then I model it by reducing it to binomials.

My question is the following two model is equivalent or not in Stan.

In my model, there is a random variable X=(X_1,X_2,X_3.X_4), X_i\geq0, \sum X_i =n.

Let p=(p_1,p_2,p_3), p_i >0, \sum p_i =1.

Then, the multinomial distribution is

### 1st model

X \sim \text{Multinomial}(p)

On the other hand, we can reduce the above to binomial distributions as follows

### 2nd model

X_3 \sim \text{Binomial}(p_3,n)

X_2 \sim \text{Binomial}(\frac{p_2}{1-p_3},n-X_3)

X_1 \sim \text{Binomial}(\frac{p_1}{1-p_3-p_2},n-X_3-X_2)

X_4:= n-X_1-X_2-X_3.

This reduction is also used, e.g., `?rmultinom`

in `stats`

package.

I use the above both model in my model, then the behavour of HMC is not same. E.g., for some data, one of them converges but the other dose not.

In Stan, the multinomial distribution is defiend using the above reduction to binomials? Namely, the above two are equivalent?