How to get the probability of being over/under a certain value for a parameter?

Hi everyone, I have a question that I can’t seem to easily answer.

Once I get the full posterior distribution of a parameter, let’s say \beta_1, during inference.
How do I get the density of the parameter being over 1, 2, 3 or some value ?

How do I easily tell and show that 20% of the prob. density is under 0.5 or over 1.3 for example?

Thanks

1 Like

Do you have the trace with the posterior samples? If so you can use numpy for simple stats

np.mean(trace['beta_1']>1.3)

4 Likes

As Nicholas said, it’s the beauty of Bayesian inference: you just have to count the scenarios of interest among all the possible scenarios in your model.
In addition to stats, you can use arviz.plot_posterior's ref_val argument: https://arviz-devs.github.io/arviz/generated/arviz.plot_posterior.html#arviz.plot_posterior

3 Likes

Exactly that, thank you!!

Good stuff, thank you guys for the help =)