'Normal-gamma distribution in Python

Is there an implementation of the Normal-Gamma distribution for Python? I have looked over the internet, including scipy, and could not find it.



Solution 1:[1]

I am not aware of any package which implements it.
But since its building blocks are the Gamma Distribution and the Normal Distribution you may use them from SciPy.

For instance, in order to generate samples you may do (From Wikipedia - Normal Gamma Distribution):

  • Sample ? (\tau) from a gamma distribution with parameters ? (\alpha) and ? (\beta).
  • Sample x from a normal distribution with mean ? (\mu) and variance 1 / ? ? (1 / (\lambda \tau)).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Royi