# How to add (soft?) constraints to the model?

Sorry for a newbie question. I have a simple model like so:

``````model = pm.Model()
with model:

# Priors for unknown model parameters
a = pm.Normal('a', mu=0, sd=10, shape=(4, 1))
b = pm.Normal('b', mu=0, sd=10, shape=(1, 4))
c = pm.Normal('offset', mu=0, sd=10)

# Expected probabilities (4 x 4)
p = sigmoid(a + b + c)

# Likelihood (sampling distribution) of observations, data, N_data = (4 x 4)
pm.Binomial('L', n=N_data, p=p, observed=data_successes)
``````

Now I want to obtain parameters `a`, `b` and `c` via MCMC but I want to incorporate additional information like:

``````x0 = x1* f(a, b, c) + x2 * f(a, b, c)  + x3 * f(a, b, c)
x4 = x5* f(a, b, c) + x6 * f(a, b, c)  + x7 * f(a, b, c)
....
``````

Where [x0, x1, …] are known (`f` is just a sigmoid), `a`, `b` and `c` are results of MCMC so they’re not “hard” constraints per se. Is this possible?

Depending on the function f(), it might not be easy to do. One approach is to add the constrain using pm.Potential, but I am not sure it applies here.

The function is sigmoid. I wonder how to incorporate this additional information I have to help with the learning… I’m not sure if this could be integrated into the prior either

It would be much easier if we have a solver for algebraic equation, but we dont…

Could you explain what you mean by a solver for algebraic equation & how would it help?

You can find more information in the stan manual: http://mc-stan.org/users/documentation/. See part 47. In brief it allows you to put down the system of equation in your model as constrain without specifically work out how to express the solution.