Hi all,

I am trying to rewrite a GLM model in Stan (based on a non-Bayesian model someone else in my company wrote in MATLAB many years ago). There are a set of multiple parameters that are all related – all of them are also 0-1 (but not necessarily exclusive).

In the MATLAB model, these parameters are subject to a constraint that sets their overall trend to be 0 (i.e. if one were to apply a linear regression to coefficients g1, g2, g3, g4, g5, (with x = 1, 2, 3, 4, 5), the slope would be 0). It does this by adding an extra row to the model matrix, with entries as 0 for every variable except for g1-g5. Those have entries c1-c5, set as \sum_{i=1}^{5}(c_i *g_i) = 0. They then wrote a new IRLS function that solves for the coefficients while keeping this constraint.

Is there any way to do something like this in STAN – either just set a linear constraint on a set of coefficients, or add a row of dummy predictors to the model matrix, and solve it all at the same time?

Sorry if the above was unclear, I can try to explain further if necessary.