3
$\begingroup$

I'm attempting to learn Bayesian modelling with PyMC, so I have been going through Cam Pilon Davidson's Probabilistic Programming for Hackers. I literally copied his code from chapter 1 and used my own storm data. Here is the ipython notebook of my code.

My problem is with the posterior distributions. One of them returns probabilities over 1. Or are they not actually probabilities? Should I be using a different alpha for my exponential distributions? Am I asking the right questions?

I'm not a heavy math person, so I may have a fundamental misunderstanding about what is going on here...

Thanks for any help!

$\endgroup$
  • $\begingroup$ I guess you are confusing probability and probability density. For continuous variables in particular, probability density is probability per unit of measurement, and it should integrate to 1, but nothing stops particular values being above 1. $\endgroup$ – Nick Cox May 19 '14 at 18:47
  • 1
    $\begingroup$ This is a FAQ on this site. $\endgroup$ – cardinal May 19 '14 at 19:16
  • $\begingroup$ Don't worry. Closely related questions aren't always easy to find. Welcome to the site. Cam is an active participant here, so I'm sure any questions you have on his book will be well-received by him and others. Cheers. $\endgroup$ – cardinal May 19 '14 at 19:44
  • $\begingroup$ @De.rek absolutely happy to help! In fact, you bring up a common misunderstanding that I really should address early on. Thanks for the feedback! $\endgroup$ – Cam.Davidson.Pilon May 19 '14 at 20:53
  • $\begingroup$ @Cam.Davidson.Pilon That sounds great! Maybe you can be on my thesis committee... Thanks for your book, its great! $\endgroup$ – De.rek May 19 '14 at 23:10
2
$\begingroup$

Probabilities cannot exceed 1, but probability densities can. If you're dealing with a continuous random variable (it seems like you are although I have a hard time following what's going on in your code) the density may well take values greater than 1. In order for it to be a well-defined probability density it is only necessary that:

  1. The area under the curve integrates to 1.
  2. The density is non-negative
$\endgroup$
  • $\begingroup$ Thanks for your reply! I have some reading on probability densities to do.. $\endgroup$ – De.rek May 19 '14 at 23:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.