# Modelling mixing proportions/simplex parameters in brms?

Within `brms`, is there any way to specify mixing proportions of three (or more) predictors. The closest I have achieved so far is to use `brms` nonlinear formula syntax.

Mixing just `X1` and` X2` is straightforward because I can set a prior for `omega` so it is in the interval [0, 1]:

`````` y ~ alpha + beta * (omega * X1 + (1 - omega * X2))
``````

But, what can I do when I have three things to mix: `X1`, `X2`, and `X3`?

`````` y ~ alpha + beta * (omega1 * X1 + omega2 * X2 + (1 - omega1 - omega2) * X3)
``````

Is there a way to specify a prior to keep both `omega1` and `omega1 + omega2` in [0, 1]? Or is there a different way of specifying this type of model in the formula that would achieve the same thing?

Or is this something that would require adapting the Stan code produced by brms?

Any ideas would be gratefully received!

Bumping this up, in case anyone has any insights. Many thanks.

Hi, looking at the math of what you’re describing, assuming that beta and omega are both free parameters, your model is equivalent to a simple linear model with coefficients alpha, b1 = beta * omega1, b2= beta * omega2, and b3= beta * (1-omega1-omega2). Therefore, you could just as easily fit a straightforward linear model. And if you must, derive the omega values posthoc (although i dont really see the added value). I also don’t think what you’re describing is technically a mixture model. Mixture models describe how an observation may arise from two or more different distributions.

Hi, thank you for responding. I realise this can be reparameterised as a linear model but what is not clear to me is if it is possible, within brms or a modification of its Stan code, to specify that the omega parameters (omega1, omega2, and omega3 = (1 - omega1 - omega2)) are each <= 1 and sum to 1 and, hence, represent “mixing proportions” (I didn’t intend to suggest a mixture model with that term).

Ok :). Sure its possible to modify the Stan code manually and define omega as a simplex vector (i.e. all elements between 0 and 1, and elements sum up to 0). Im
Not sure if or how brms would handle the adapted code, but you should be able to run it with rstan for sure.

Thanks – I’ll have a tinker with the Stan code (never done that before) and see what I can come up with.