 to checking
that its arguments are strictly positive.)
The main differences are as follows.

- The support of the distribution is a set of integers.
- Instead of the probability density function, ``pdf`` (and the
  corresponding private ``_pdf``), this class defines the
  *probability mass function*, `pmf` (and the corresponding
  private ``_pmf``.)
- There is no ``scale`` parameter.
- The default implementations of methods (e.g. ``_cdf``) are not designed
  for distributions with support that is unbounded below (i.e.
  ``a=-np.inf``), so they must be overridden.

To create a new discrete distribution, we would do the following:

>>> from scipy.stats import rv_discrete
>>> class poisson_gen(rv_discrete):
...     "Poisson distribution"
...     def _pmf(self, k, mu):
...         return exp(-mu) * mu**k / factorial(k)

and create an instance::

>>> poisson = poisson_gen(name="poisson")

Note that above we defined the Poisson distribution in the standard form.
Shifting the distribution can be done by providing the ``loc`` parameter
to the methods of the instance. For example, ``poisson.pmf(x, mu, loc)``
delegates the work to ``poisson._pmf(x-loc, mu)``.

**Discrete distributions from a list of probabilities**

Alternatively, you can construct an arbitrary discrete rv defined
on a finite set of values ``xk`` with ``Prob{X=xk} = pk`` by using the
``values`` keyword argument to the `rv_discrete` constructor.

**Deepcopying / Pickling**

If a distribution or frozen distribution is deepcopied (pickled/unpickled,
etc.), any underlying random number generator is deepcopied with it. An
implication is that if a distribution relies on the singleton RandomState
before copying, it will rely on a copy of that random state after copying,
and ``np.random.seed`` will no longer control the state.

Examples
--------
Custom made discrete distribution:

>>> import numpy as np
>>> from scipy import stats
>>> xk = np.arange(7)
>>> pk = (0.1, 0.2, 0.3, 0.1, 0.1, 0.0, 0.2)
>>> custm = stats.rv_discrete(name='custm', values=(xk, pk))
>>>
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots(1, 1)
>>> ax.plot(xk, custm.pmf(xk), 'ro', ms=12, mec='r')
>>> ax.vlines(xk, 0, custm.pmf(xk), colors='r', lw=4)
>>> plt.show()

Random number generation:

>>> R = custm.rvs(size=100)

r