.. _book_fig_chapter3_fig_poisson_distribution: Example of a Poisson distribution ---------------------------------- Figure 3.10. This shows an example of a Poisson distribution with various parameters. We'll generate the distribution using:: dist = scipy.stats.poisson(...) Where ... should be filled in with the desired distribution parameters Once we have defined the distribution parameters in this way, these distribution objects have many useful methods; for example: * ``dist.pmf(x)`` computes the Probability Mass Function at values ``x`` in the case of discrete distributions * ``dist.pdf(x)`` computes the Probability Density Function at values ``x`` in the case of continuous distributions * ``dist.rvs(N)`` computes ``N`` random variables distributed according to the given distribution Many further options exist; refer to the documentation of ``scipy.stats`` for more details. .. image:: ../images/chapter3/fig_poisson_distribution_1.png :scale: 100 :align: center .. raw:: html
**Code output:** .. raw:: html
.. literalinclude:: fig_poisson_distribution.txt .. raw:: html
**Python source code:** .. raw:: html
.. literalinclude:: fig_poisson_distribution.py :lines: 27- .. raw:: html
:download:`[download source: fig_poisson_distribution.py] ` .. raw:: html