I’ve built a model without specifying any 'observed = ', and then I used pm.sample. Can anyone help me to explain the meaning of mean and std in pm.summary for every node? Is this the sampling result of prior or posterior predictive distribution? Thank you!
Sampling without specifying an observed is the same as sampling from the prior distribution. Sometimes this is useful in itself, for example in models with certain constraints (example:
Sorted transformations, or arbitrary
Potential terms) that do not correspond to any default distributions.
Hey thank you for your reply! Can you plz further explain why the mean and std of data simulated from prior distribution is not 0 and 1, given that it was set to be standard normal distributed in the model?
Can you share the code and results of
pm.summary that you are referring to?
Hey sorry the code is too complicated and due to Non-disclosure Agreement with a company I cannot share it, but I write something as an example.
And the result is something like this:
Even if you don’t show the original model, can you show a minimal example? This works fine
with pm.Model() as m:
x = pm.Normal('x', 0, 1)
trace = pm.sample()
mean sd hdi_3% hdi_97% mcse_mean mcse_sd ess_mean ess_sd ess_bulk ess_tail r_hat
x 0.039 1.025 -1.814 1.99 0.025 0.018 1638.0 1638.0 1640.0 2601.0 1.0
If your prior samples don’t correspond to your priors it must be because your model has some implicit constraints somewhere
Hi, thanks for pointing out! Below is an example of my model. Sorry I am really new to this, so I really appreciate it if you can tell me how to type code in the comment…
And what values are not similar to their prior? Can you share the actual values you are seeing and the ones you were expecting to see?
Yeah, these two are defined to be standard normally distributed, but now the mean and sigma is not 0 and 1. Actually they are interaction coefficients. For example, beta_B_to_tgt is the impact of B on target. I define it to be standard normally distributed, because I assume there are no interaction between these two variables. However, you can see that the mean is 0.794, so can I say they have some correlations in fact?
Edit: Well, I just checked the example code I wrote for you, and these two interaction coefficients were defined as halfnormal. But the cases that I mentioned above do exist for some other coefficients, that is, defined as Standard Normal but actually the mean and std is not 0 and 1.