Hello everyone, PyMC3 and Bayesian modeling beginner here.
I have a variable that I want to model as the latent continuous variable rounded to an integer, and was wondering what would be the appropriate way to do that.
Let’s say for example if I am measuring a weight, and I know my measuring process produces rounded integer values, but that the latent weight is continuous.
At first I thought of modeling the latent weight (with a Gamma prior for example) and then define the observed weight as the rounded latent via pm.Deterministic but Deterministic doesn’t take an observed if I am correct.
Any idea or advice that would help me ?
A wrong but easy way to deal with this is to assign the discrete observed directly to the latent continuous variable.
If you want to handle this mathematically correct, the only way I can think of is to write down the cdf of the latent variable, and write a potential function that integrate the area between the rounding boundary.
For example, say your latent variable is a
Normal(mu, sd) and the observed is 4, you would assign the likelihood to this observed being log(Normal(mu, sd).cdf(4.5) - Normal(mu, sd).cdf(3.5) - Normal(mu, sd).pdf(4.5)), so that you integrate the area between
[3.5, 4.5) (the range of value that would round to 4).
Thank you for your suggestion, I will try that !