So it looks like using
TruncatedNormal for truncated data is inappropriate and that should be used for data which is censored (not truncated). And that for truncated data, bounded normals are appropriate.
Which makes my previous example of truncated regression https://github.com/drbenvincent/pymc3-demo-code/blob/master/truncated_regression_pymc3.ipynb wrong (as it used
I changed that to use Bounds…
BoundedNormal = pm.Bound(pm.Normal, lower=truncation_bounds, upper=truncation_bounds) y_likelihood = BoundedNormal("y_likelihood", mu=m * x + c, sd=σ, observed=y)
but it looks like we can’t use bounds for observed data…
ValueError: Observed Bound distributions are not supported. If you want to model truncated data you can use a pm.Potential in combination with the cumulative probability function. See pymc3/examples/censored_data.py for an example.
This points you to an example on censored data, which seems inappropriate given the task is truncated data. And it seems frustrating that you can’t use a bounded/truncated normal with observed data - but I don’t know if there are technical reasons for that. Either way it would be good if you could.
Is there a concrete example/explanation of how you can model truncated (not censored) observed data? Any ideas very welcome.