Hi all, my name is Alejandro. I would like to know if there is a possibility to adjust a Bayesian model with a set of parameters constrained by a non-linear equation. For example, I have this set of parameters

parameters {
real beta0;
real beta1;
real q;
real beta2;
real<lower=0> alpha1;
}

and I want q and \alpha to be restricted by:

\frac{1}{q^{1/ \alpha}}-e^{-f(\alpha|q)}=1

for a specific function f.

Thanks for the attention and the help you can provide me.

For this model, I believe you don’t need to specify both \alpha and q as parameters with constraints. I think you should be able to specify one of them as a parameter, and then solve for the other in the transformed parameters block.

In other words, given the function:

\frac{1}{q^{1/a}} - e^{-f(a|q)} = 1

If you re-arrange/solve the function to give the value of either a or q, given the other, you can use this expression in your stan model. As a simpler example, let’s say your constraint was: