Observed Variable as a Range

Is it possible to model an observed random variable as a range or interval? In my case, the likelihood function has a deterministic part (which happens to be a black-box simulation), and I’d like the inference to consider a range of values as possible observations. For example, the simulation output is 0.15 and the observation is in the range [0.12, 0.18], so that’s a good output from the simulation. But if the simulation output is 0.15 and the observed range is [0.16, 0.2] or [0.08, 0.12], then the simulation output is not good.

You might consider using pm.Potential() to directly, if perhaps inelegantly, crafting a likelihood that reproduces whatever you think “good” and “not good” matches are. You might check out this notebook to see if it helps.

1 Like

That’s certainly helpful! But I’m getting the following warning when calling sample_prior_predictive:

C:\Users\username\Miniconda3\envs\myenv\lib\site-packages\pymc3\sampling.py:1944: UserWarning: The effect of Potentials on other parameters is ignored during prior predictive sampling. This is likely to lead to invalid or biased predictive samples.
  warnings.warn(

Should I be worried?

1 Like

As the warning states, the potential is going to be ignored when sampling from your prior. Whether you should be worried depends on what you are expecting/wanting out of your prior samples.

Got it. I should be fine then. I’m sampling from the priors just to plot a histogram and compare that to the posterior samples.

1 Like

Always a smart move!