I wish to model a system that has a certain level of performance, and then various kinds of degradations.

The basic model is

```
perf = (ax + b) * gamma
```

The most important constraint is that the degradation is 0 < gamma <= 1.0. In the ultimate model I’ll have a couple of different multiplicative degradations, each dependent on different dependent variables.

Here is a simpler example, additive instead of multiplicative, and just a constant base. I have a base level of performance, and then that level is degraded by a ‘cognitive’ term that is positive. I don’t know how to add observed data to anything other than a distribution. So I added a small Normal (noise) term with a very small prior.

This feels ill-posed, although I know the answer I want. The base performance can be any value, as long as the degradation term has a hard cutoff (zero in the example below.). With the real data, I want to model the degradations with an exponential fall off starting at 1.

How do I write this in PyMC?

Thanks.

– Malcolm

```
n = 1000
data = np.random.uniform(size=n)*.1 + 0.7
with pm.Model() as simple_model:
base = pm.Normal('base', mu=0.5, sigma=0.5)
cog_state = pm.Uniform('state')
degraded = pm.Deterministic('degraded', base - cog_state)
y_pred = pm.Normal('y_pred', mu=degraded, sigma=.01, observed=data)
idata_simple = pm.sample()
```