ó
    Eñi3 ã                   ó`  • S SK Jr  S SKJr  S SKJrJrJrJr	  S SK
Js  Jr  S SKJr  S SKJs  Jr  S SKJr  S SKJrJrJrJrJrJrJrJrJrJr  S SKr SS	K!J"r"J#r#J$r$J%r%J&r&J'r'  SS
K(J)r)J*r*J+r+  SSK,J-r-   " S S\"5      r.\." SS9r/ " S S\.5      r0\0" SSS9r1 " S S\"5      r2\2" SS9r3 " S S\"5      r4\4" SS9r5 " S S\"5      r6\6" SS9r7 " S S\"5      r8\8" SSS S!9r9 " S" S#\"5      r:\:" S$S9r; " S% S&\"5      r<\<" S'S9r= " S( S)\"5      r>\>" SS*S+S!9r? " S, S-\"5      r@\@" S.S/S09rA " S1 S2\"5      rB\B" S S3S4S!9rC " S5 S6\"5      rD\D" S7S S8S99rE " S: S;\"5      rF\F" S<S=S09rG " S> S?\"5      rH\H" SS@SAS!9rI " SB SC\"5      rJ\J" SSDSES!9rK " SF SG\"5      rL\L" \ Rš                  * SHSIS!9rN " SJ SK\"5      rO\O" SLSMSNSO9rPSgSP jrQShSQ jrRSiSR jrS\P\OsrTrU\QR­                  \T\U5      \PlQ        \RR­                  \T\U5      \PlR        \SR­                  \T\U5      \PlS         " SS ST\'5      rW " SU SV\"5      rX\X" \ Rš                  * SWSXS!9rY " SY SZ\"5      rZ\Z" S[SS\9r[ " S] S^\"5      r\ " S_ S`\\5      r]\]" SaSbS09r^ " Sc Sd\\5      r_\_" SeSfS09r`\a" \b" 5       RÇ                  5       RÉ                  5       5      re\#" \e\"5      u  rfrg\f\g-   rhg)jé    )Úpartial)Úspecial)ÚentrÚ	logsumexpÚbetalnÚgammalnN)Úrng_integers)Úinterp1d)
ÚfloorÚceilÚlogÚexpÚsqrtÚlog1pÚexpm1ÚtanhÚcoshÚsinhé   )Úrv_discreteÚget_distribution_namesÚ_vectorize_rvs_over_shapesÚ
_ShapeInfoÚ_isintegralÚrv_discrete_frozen)Ú_PyFishersNCHypergeometricÚ_PyWalleniusNCHypergeometricÚ_PyStochasticLib3)Ú_poisson_binomc                   óh   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rS rS rSS jrS rSrg)Ú	binom_gené   aÚ  A binomial discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `binom` is:

.. math::

   f(k) = \binom{n}{k} p^k (1-p)^{n-k}

for :math:`k \in \{0, 1, \dots, n\}`, :math:`0 \leq p \leq 1`

`binom` takes :math:`n` and :math:`p` as shape parameters,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

This distribution uses routines from the Boost Math C++ library for
the computation of the ``pmf``, ``cdf``, ``sf``, ``ppf`` and ``isf``
methods. [1]_

%(after_notes)s

References
----------
.. [1] The Boost Developers. "Boost C++ Libraries". https://www.boost.org/.

%(example)s

See Also
--------
hypergeom, nbinom, nhypergeom

c                 óZ   • [        SSS[        R                  4S5      [        SSSS5      /$ ©	NÚnTr   ©TFÚpF©r   r   ©TT©r   ÚnpÚinf©Úselfs    ÚY/home/mande/repo/quber/.venv/lib/python3.13/site-packages/scipy/stats/_discrete_distns.pyÚ_shape_infoÚbinom_gen._shape_info@   ó0   € Ü˜3  q¬"¯&©& k°=ÓAÜ˜3  v¨|Ó<ð>ð 	>ó    Nc                 ó&   • UR                  XU5      $ ©N)Úbinomial©r.   r%   r'   ÚsizeÚrandom_states        r/   Ú_rvsÚbinom_gen._rvsD   s   € Ø×$Ñ$ Q¨4Ó0Ð0r3   c                 ó<   • US:¬  [        U5      -  US:¬  -  US:*  -  $ ©Nr   r   ©r   ©r.   r%   r'   s      r/   Ú	_argcheckÚbinom_gen._argcheckG   s'   € Ø�Q‘œ+ a›.Ñ(¨A°©FÑ3°q¸A±vÑ>Ð>r3   c                 ó   • U R                   U4$ r5   ©Úar?   s      r/   Ú_get_supportÚbinom_gen._get_supportJ   s   € Ø�v‰v�qˆyÐr3   c                 óÜ   • [        U5      n[        US-   5      [        US-   5      [        X$-
  S-   5      -   -
  nU[        R                  " XC5      -   [        R                  " X$-
  U* 5      -   $ ©Nr   )r   Úgamlnr   ÚxlogyÚxlog1py)r.   Úxr%   r'   ÚkÚcombilns         r/   Ú_logpmfÚbinom_gen._logpmfM   s\   € Ü�!‹HˆÜ˜˜1™“:¤ q¨¡s£¬e°A±C¸±E«lÑ!:Ñ;ˆØœŸš qÓ,Ñ,¬w¯ª¸q¹sÀQÀBÓ/GÑGÐGr3   c                 ó0   • [         R                  " XU5      $ r5   )ÚscuÚ
_binom_pmf©r.   rL   r%   r'   s       r/   Ú_pmfÚbinom_gen._pmfR   s   € ä�~Š~˜a AÓ&Ð&r3   c                 óF   • [        U5      n[        R                  " XBU5      $ r5   )r   rR   Ú
_binom_cdf©r.   rL   r%   r'   rM   s        r/   Ú_cdfÚbinom_gen._cdfV   ó   € Ü�!‹HˆÜ�~Š~˜a AÓ&Ð&r3   c                 óF   • [        U5      n[        R                  " XBU5      $ r5   )r   rR   Ú	_binom_sfrY   s        r/   Ú_sfÚbinom_gen._sfZ   s   € Ü�!‹HˆÜ�}Š}˜Q 1Ó%Ð%r3   c                 ó0   • [         R                  " XU5      $ r5   )rR   Ú
_binom_isfrT   s       r/   Ú_isfÚbinom_gen._isf^   ó   € Ü�~Š~˜a AÓ&Ð&r3   c                 ó0   • [         R                  " XU5      $ r5   )rR   Ú
_binom_ppf©r.   Úqr%   r'   s       r/   Ú_ppfÚbinom_gen._ppfa   re   r3   c                 ó†  • X-  nXA[         R                  " U5      -  -
  nSu  pgSU;   aS  U[         R                  " U5      -
  n[         R                  " X-  5      n	[         R                  " U	5      n
SU-  U	-  nX«-
  nSU;   a<  U[         R                  " U5      -
  nX-  n[         R                  " U5      n
SU-  nX«-
  nXEXg4$ )N©NNÚsç       @rM   ç      @)r+   Úsquarer   Ú
reciprocal)r.   r%   r'   ÚmomentsÚmuÚvarÚg1Úg2ÚpqÚnpq_sqrtÚt1Út2Únpqs                r/   Ú_statsÚbinom_gen._statsd   s¸   € Ø‰UˆØ”r—y’y “|Ñ#Ñ#ˆØ‰ˆØ�'‹>Ø”R—Y’Y˜q“\Ñ!ˆBÜ—w’w˜q™v“ˆHÜ—’˜xÓ(ˆBØ˜‘'˜XÑ%ˆBØ‘ˆBØ�'‹>Ø”R—Y’Y˜q“\Ñ!ˆBØ‘&ˆCÜ—’˜sÓ#ˆBØ�Q‘ˆBØ‘ˆBØ˜ˆÐr3   c                 óŽ   • [         R                  SUS-    nU R                  X1U5      n[         R                  " [	        U5      SS9$ )Nr   r   ©Úaxis)r+   Úr_rU   Úsumr   )r.   r%   r'   rM   Úvalss        r/   Ú_entropyÚbinom_gen._entropyv   s:   € Ü�E‰E�!�A˜‘EˆNˆØ�y‰y˜˜qÓ!ˆÜ�vŠv”d˜4“j qÑ)Ð)r3   © rm   ©Úmv©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r0   r:   r@   rE   rO   rU   rZ   r_   rc   rj   r}   r…   Ú__static_attributes__r‡   r3   r/   r!   r!      sE   † ñ"òF>ô1ò?òòHò
'ò'ò&ò'ò'ôõ$*r3   r!   Úbinom)Únamec                   ód   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rS rS rS rS rSrg)Úbernoulli_gené   aç  A Bernoulli discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `bernoulli` is:

.. math::

   f(k) = \begin{cases}1-p  &\text{if } k = 0\\
                       p    &\text{if } k = 1\end{cases}

for :math:`k` in :math:`\{0, 1\}`, :math:`0 \leq p \leq 1`

`bernoulli` takes :math:`p` as shape parameter,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

%(after_notes)s

%(example)s

c                 ó    • [        SSSS5      /$ ©Nr'   Fr(   r)   ©r   r-   s    r/   r0   Úbernoulli_gen._shape_info˜   ó   € Ü˜3  v¨|Ó<Ð=Ð=r3   Nc                 ó.   • [         R                  U SXUS9$ )Nr   ©r8   r9   )r!   r:   ©r.   r'   r8   r9   s       r/   r:   Úbernoulli_gen._rvs›   s   € Ü�~‰~˜d A qÀ,ˆ~ÐOÐOr3   c                 ó   • US:¬  US:*  -  $ r=   r‡   ©r.   r'   s     r/   r@   Úbernoulli_gen._argcheckž   s   € Ø�Q‘˜1 ™6Ñ"Ð"r3   c                 ó2   • U R                   U R                  4$ r5   )rD   Úbr    s     r/   rE   Úbernoulli_gen._get_support¡   s   € à�v‰v�t—v‘vˆ~Ðr3   c                 ó0   • [         R                  USU5      $ rH   )r‘   rO   ©r.   rL   r'   s      r/   rO   Úbernoulli_gen._logpmf¥   s   € Ü�}‰}˜Q  1Ó%Ð%r3   c                 ó0   • [         R                  USU5      $ rH   )r‘   rU   r¦   s      r/   rU   Úbernoulli_gen._pmf¨   s   € ô �z‰z˜!˜Q Ó"Ð"r3   c                 ó0   • [         R                  USU5      $ rH   )r‘   rZ   r¦   s      r/   rZ   Úbernoulli_gen._cdf­   ó   € Ü�z‰z˜!˜Q Ó"Ð"r3   c                 ó0   • [         R                  USU5      $ rH   )r‘   r_   r¦   s      r/   r_   Úbernoulli_gen._sf°   s   € Ü�y‰y˜˜A˜qÓ!Ð!r3   c                 ó0   • [         R                  USU5      $ rH   )r‘   rc   r¦   s      r/   rc   Úbernoulli_gen._isf³   r¬   r3   c                 ó0   • [         R                  USU5      $ rH   )r‘   rj   )r.   ri   r'   s      r/   rj   Úbernoulli_gen._ppf¶   r¬   r3   c                 ó.   • [         R                  SU5      $ rH   )r‘   r}   r    s     r/   r}   Úbernoulli_gen._stats¹   s   € Ü�|‰|˜A˜qÓ!Ð!r3   c                 ó6   • [        U5      [        SU-
  5      -   $ rH   )r   r    s     r/   r…   Úbernoulli_gen._entropy¼   s   € Ü�A‹wœ˜a ™c›Ñ"Ð"r3   r‡   rm   rŠ   r‡   r3   r/   r”   r”      sD   † ñò0>ôPò#òò&ò#ò
#ò"ò#ò#ò"õ#r3   r”   Ú	bernoulli)r£   r’   c                   óJ   • \ rS rSrSrS rSS jrS rS rS r	S	 r
SS
 jrSrg)Úbetabinom_genéÃ   a¾  A beta-binomial discrete random variable.

%(before_notes)s

Notes
-----
The beta-binomial distribution is a binomial distribution with a
probability of success `p` that follows a beta distribution.

The probability mass function for `betabinom` is:

.. math::

   f(k) = \binom{n}{k} \frac{B(k + a, n - k + b)}{B(a, b)}

for :math:`k \in \{0, 1, \dots, n\}`, :math:`n \geq 0`, :math:`a > 0`,
:math:`b > 0`, where :math:`B(a, b)` is the beta function.

`betabinom` takes :math:`n`, :math:`a`, and :math:`b` as shape parameters.

%(after_notes)s

References
----------
.. [1] https://en.wikipedia.org/wiki/Beta-binomial_distribution

.. versionadded:: 1.4.0

See Also
--------
beta, binom

%(example)s

c                 ó´   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      [        SSS[        R                  4S5      /$ ©	Nr%   Tr   r&   rD   F©FFr£   r*   r-   s    r/   r0   Úbetabinom_gen._shape_infoç   óP   € Ü˜3  q¬"¯&©& k°=ÓAÜ˜3 ¨¬2¯6©6 {°NÓCÜ˜3 ¨¬2¯6©6 {°NÓCðEð 	Er3   Nc                 óJ   • UR                  X#U5      nUR                  XU5      $ r5   )Úbetar6   ©r.   r%   rD   r£   r8   r9   r'   s          r/   r:   Úbetabinom_gen._rvsì   s'   € Ø×Ñ˜a DÓ)ˆØ×$Ñ$ Q¨4Ó0Ð0r3   c                 ó
   • SU4$ ©Nr   r‡   ©r.   r%   rD   r£   s       r/   rE   Úbetabinom_gen._get_supportð   ó   € Ø�!ˆtˆr3   c                 ó<   • US:¬  [        U5      -  US:„  -  US:„  -  $ rÅ   r>   rÆ   s       r/   r@   Úbetabinom_gen._argcheckó   ó'   € Ø�Q‘œ+ a›.Ñ(¨A°©EÑ2°a¸!±eÑ<Ð<r3   c                 ó¤   • [        U5      n[        US-   5      * [        X%-
  S-   US-   5      -
  nU[        XS-   X%-
  U-   5      -   [        X45      -
  $ rH   )r   r   r   ©r.   rL   r%   rD   r£   rM   rN   s          r/   rO   Úbetabinom_gen._logpmfö   sS   € Ü�!‹HˆÜ�q˜1‘u“:�+¤ q¡u¨q¡y°!°a±%Ó 8Ñ8ˆØœ ¡ q¡u¨q¡yÓ1Ñ1´F¸1³LÑ@Ð@r3   c                 ó8   • [        U R                  XX45      5      $ r5   ©r   rO   ©r.   rL   r%   rD   r£   s        r/   rU   Úbetabinom_gen._pmfû   ó   € Ü�4—<‘<  aÓ+Ó,Ð,r3   c                 ó(  • X"U-   -  nSU-
  nX-  nXU-   U-   -  U-  U-  X#-   S-   -  nSu  pšSU;   a/  S[        U5      -  n	X’U-   SU-  -   X2-
  -  -  n	X’U-   S-   X#-   -  -  n	SU;   a¨  X#-   R                  UR                  5      n
X¢U-   S-
  SU-  -   -  n
U
SU-  U-  US-
  -  -  n
U
SUS-  -  -  n
U
SU-  U-  U-  SU-
  -  -  n
U
S	U-  U-  US-  -  -  n
X¢U-   S-  SU-   U-   -  -  n
X¡U-  U-  X#-   S-   -  X#-   S-   -  X#-   U-   -  -  n
U
S-  n
XxXš4$ )
Nr   rm   rn   ç      ð?é   rM   é   é   é   )r   ÚastypeÚdtype)r.   r%   rD   r£   rs   Úe_pÚe_qrt   ru   rv   rw   s              r/   r}   Úbetabinom_gen._statsþ   sŠ  € Ø�q‘5‰kˆØ�#‰gˆØ‰WˆØ�q‘5˜1‘9‰o Ñ# cÑ)¨Q©U°Q©YÑ7ˆØ‰ˆØ�'‹>Ø”t˜C“y‘ˆBØ�q‘5˜1˜q™5‘= Q¡UÑ+Ñ+ˆBØ�q‘5˜1‘9 ¡Ñ'Ñ'ˆBØ�'‹>Ø‘%—‘ §	¡	Ó*ˆBØ�q‘5˜1‘9˜q 1™uÑ$Ñ%ˆBØ�!�a‘%˜!‘)˜q 1™uÑ%Ñ%ˆBØ�!�a˜1‘f‘*ÑˆBØ�!�c‘'˜A‘+ ‘/ Q¨¡UÑ+Ñ+ˆBØ�"�s‘(˜S‘. 1¨¡6Ñ)Ñ)ˆBØ�q‘5˜Q‘, ! a¡%¨!¡)Ñ,Ñ,ˆBØ�q‘5˜1‘9 ¡¨¡	Ñ*¨a©e°a©iÑ8¸A¹EÀA¹IÑFÑGˆBØ�!‰GˆBØ˜ˆÐr3   r‡   rm   rˆ   )r‹   rŒ   r�   rŽ   r�   r0   r:   rE   r@   rO   rU   r}   r�   r‡   r3   r/   r¹   r¹   Ã   s-   † ñ"òFEô
1òò=òAò
-÷r3   r¹   Ú	betabinomc                   ó^   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rS rS rS rSrg)Ú
nbinom_geni  a?  A negative binomial discrete random variable.

%(before_notes)s

Notes
-----
Negative binomial distribution describes a sequence of i.i.d. Bernoulli
trials, repeated until a predefined, non-random number of successes occurs.

The probability mass function of the number of failures for `nbinom` is:

.. math::

   f(k) = \binom{k+n-1}{n-1} p^n (1-p)^k

for :math:`k \ge 0`, :math:`0 < p \leq 1`

`nbinom` takes :math:`n` and :math:`p` as shape parameters where :math:`n`
is the number of successes, :math:`p` is the probability of a single
success, and :math:`1-p` is the probability of a single failure.

Another common parameterization of the negative binomial distribution is
in terms of the mean number of failures :math:`\mu` to achieve :math:`n`
successes. The mean :math:`\mu` is related to the probability of success
as

.. math::

   p = \frac{n}{n + \mu}

The number of successes :math:`n` may also be specified in terms of a
"dispersion", "heterogeneity", or "aggregation" parameter :math:`\alpha`,
which relates the mean :math:`\mu` to the variance :math:`\sigma^2`,
e.g. :math:`\sigma^2 = \mu + \alpha \mu^2`. Regardless of the convention
used for :math:`\alpha`,

.. math::

   p &= \frac{\mu}{\sigma^2} \\
   n &= \frac{\mu^2}{\sigma^2 - \mu}

This distribution uses routines from the Boost Math C++ library for
the computation of the ``pmf``, ``cdf``, ``sf``, ``ppf``, ``isf``
and ``stats`` methods. [1]_

%(after_notes)s

References
----------
.. [1] The Boost Developers. "Boost C++ Libraries". https://www.boost.org/.

%(example)s

See Also
--------
hypergeom, binom, nhypergeom

c                 óZ   • [        SSS[        R                  4S5      [        SSSS5      /$ r$   r*   r-   s    r/   r0   Únbinom_gen._shape_infoS  r2   r3   Nc                 ó&   • UR                  XU5      $ r5   )Únegative_binomialr7   s        r/   r:   Únbinom_gen._rvsW  s   € Ø×-Ñ-¨a°DÓ9Ð9r3   c                 ó$   • US:„  US:„  -  US:*  -  $ r=   r‡   r?   s      r/   r@   Únbinom_gen._argcheckZ  s   € Ø�A‘˜!˜a™%Ñ  A¨¡FÑ+Ð+r3   c                 ó0   • [         R                  " XU5      $ r5   )rR   Ú_nbinom_pmfrT   s       r/   rU   Únbinom_gen._pmf]  s   € ä�Š˜q QÓ'Ð'r3   c                 ó¢   • [        X!-   5      [        US-   5      -
  [        U5      -
  nXB[        U5      -  -   [        R                  " X* 5      -   $ rH   )rI   r   r   rK   )r.   rL   r%   r'   Úcoeffs        r/   rO   Únbinom_gen._logpmfa  sD   € Ü�a‘c“
œU 1 Q¡3›ZÑ'¬%°«(Ñ2ˆØœ˜Q›‘xÑ¤'§/¢/°!°RÓ"8Ñ8Ð8r3   c                 óF   • [        U5      n[        R                  " XBU5      $ r5   )r   rR   Ú_nbinom_cdfrY   s        r/   rZ   Únbinom_gen._cdfe  s   € Ü�!‹HˆÜ�Š˜q QÓ'Ð'r3   c                 óB  • [        U5      n[        R                  " XBU5      u  pBnU R                  XBU5      nUS:„  nS nUn[        R                  " SS9   U" XF   X&   X6   5      X†'   [        R
                  " XV)    5      X†) '   S S S 5        U$ ! , (       d  f       U$ = f)Nç      à?c                 óh   • [         R                  " [        R                  " U S-   USU-
  5      * 5      $ rH   )r+   r   r   Úbetainc)rM   r%   r'   s      r/   Úf1Únbinom_gen._logcdf.<locals>.f1n  s)   € Ü—8’8œWŸ_š_¨Q°©U°A°q¸1±uÓ=Ð=Ó>Ð>r3   Úignore)Údivide)r   r+   Úbroadcast_arraysrZ   Úerrstater   )	r.   rL   r%   r'   rM   ÚcdfÚcondrö   Úlogcdfs	            r/   Ú_logcdfÚnbinom_gen._logcdfi  sš   € Ü�!‹HˆÜ×%Ò% a¨AÓ.‰ˆˆaØ�i‰i˜˜aÓ ˆØ�S‰yˆò	?ð ˆÜ�[Š[ Ó)Ù˜a™g q¡w°±Ó8ˆF‰LÜŸFšF 3 u¡:Ó.ˆF�5‰M÷ *ð ˆ÷ *Ô)ð ˆús   Á/BÂ
Bc                 óF   • [        U5      n[        R                  " XBU5      $ r5   )r   rR   Ú
_nbinom_sfrY   s        r/   r_   Únbinom_gen._sfx  r\   r3   c                 óŽ   • [         R                  " SS9   [        R                  " XU5      sS S S 5        $ ! , (       d  f       g = f©Nrø   ©Úover)r+   rû   rR   Ú_nbinom_isfrT   s       r/   rc   Únbinom_gen._isf|  ó(   € Ü�[Š[˜hÓ'Ü—?’? 1¨Ó+÷ (×'×'úó	   •6¶
Ac                 óŽ   • [         R                  " SS9   [        R                  " XU5      sS S S 5        $ ! , (       d  f       g = fr  )r+   rû   rR   Ú_nbinom_ppfrh   s       r/   rj   Únbinom_gen._ppf€  r
  r  c                 ó®   • [         R                  " X5      [         R                  " X5      [         R                  " X5      [         R                  " X5      4$ r5   )rR   Ú_nbinom_meanÚ_nbinom_varianceÚ_nbinom_skewnessÚ_nbinom_kurtosis_excessr?   s      r/   r}   Únbinom_gen._stats„  sD   € ä×Ò˜QÓ"Ü× Ò  Ó&Ü× Ò  Ó&Ü×'Ò'¨Ó-ð	
ð 	
r3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r:   r@   rU   rO   rZ   rÿ   r_   rc   rj   r}   r�   r‡   r3   r/   rá   rá     s?   † ñ9òt>ô:ò,ò(ò9ò(òò'ò,ò,õ
r3   rá   Únbinomc                   óD   • \ rS rSrSrS rSS jrS rS rS r	SS	 jr
S
rg)Úbetanbinom_geni�  aó  A beta-negative-binomial discrete random variable.

%(before_notes)s

Notes
-----
The beta-negative-binomial distribution is a negative binomial
distribution with a probability of success `p` that follows a
beta distribution.

The probability mass function for `betanbinom` is:

.. math::

   f(k) = \binom{n + k - 1}{k} \frac{B(a + n, b + k)}{B(a, b)}

for :math:`k \ge 0`, :math:`n \geq 0`, :math:`a > 0`,
:math:`b > 0`, where :math:`B(a, b)` is the beta function.

`betanbinom` takes :math:`n`, :math:`a`, and :math:`b` as shape parameters.

%(after_notes)s

References
----------
.. [1] https://en.wikipedia.org/wiki/Beta_negative_binomial_distribution

.. versionadded:: 1.12.0

See Also
--------
betabinom : Beta binomial distribution

%(example)s

c                 ó´   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      [        SSS[        R                  4S5      /$ r¼   r*   r-   s    r/   r0   Úbetanbinom_gen._shape_infoµ  r¿   r3   Nc                 óJ   • UR                  X#U5      nUR                  XU5      $ r5   )rÁ   rå   rÂ   s          r/   r:   Úbetanbinom_gen._rvsº  s'   € Ø×Ñ˜a DÓ)ˆØ×-Ñ-¨a°DÓ9Ð9r3   c                 ó<   • US:¬  [        U5      -  US:„  -  US:„  -  $ rÅ   r>   rÆ   s       r/   r@   Úbetanbinom_gen._argcheck¾  rË   r3   c                 ó¦   • [        U5      n[        R                  " X%-   5      * [        X%S-   5      -
  nU[        X2-   XE-   5      -   [        X45      -
  $ rH   )r   r+   r   r   rÍ   s          r/   rO   Úbetanbinom_gen._logpmfÁ  sI   € Ü�!‹HˆÜ—6’6˜!™%“=�.¤6¨!°©UÓ#3Ñ3ˆØœ ¡ q¡uÓ-Ñ-´°q³Ñ<Ð<r3   c                 ó8   • [        U R                  XX45      5      $ r5   rÐ   rÑ   s        r/   rU   Úbetanbinom_gen._pmfÆ  rÓ   r3   c                 ó’  • S n[         R                  " US:„  XU4U[        R                  S9nS n[         R                  " US:„  XU4U[        R                  S9nSu  p‰S n
SU;   a*  [         R                  " US	:„  XU4U
[        R                  S9nS
 nSU;   a*  [         R                  " US:„  XU4U[        R                  S9n	XgX‰4$ )Nc                 ó   • X-  US-
  -  $ ©NrÕ   r‡   ©r%   rD   r£   s      r/   ÚmeanÚ#betanbinom_gen._stats.<locals>.meanÌ  s   € Ø‘5˜A ™FÑ#Ð#r3   r   ©Ú
fill_valuec                 óH   • X-  X-   S-
  -  X-   S-
  -  US-
  US-
  S-  -  -  $ )NrÕ   ro   r‡   r%  s      r/   ru   Ú"betanbinom_gen._stats.<locals>.varÏ  s;   € Ø‘E˜Q™U R™ZÑ(¨A©E°B©JÑ7Ø˜B™ 1 r¡6¨B¡,Ñ.ñ0ð 1r3   rÖ   rm   c                 ó„   • SU -  U-   S-
  SU-  U-   S-
  -  US-
  -  [        X-  X-   S-
  -  X!-   S-
  -  US-
  -  5      -  $ )NrÖ   rÕ   ç      @ro   ©r   r%  s      r/   ÚskewÚ#betanbinom_gen._stats.<locals>.skewÔ  sf   € Ø˜‘U˜Q‘Y ‘^¨¨A©°©	°B©Ñ7Ø˜2‘vñÜ!% a¡e¨q©u°r©zÑ&:¸a¹eÀb¹jÑ&IØ˜2‘vñ'ó " ñ ð !r3   rn   rØ   c                 ót  • US-
  nUS-
  S-  US-  USU-  S-
  -  -   SUS-
  -  U-  -   -  SU S-  -  US-   US-  -  US-   US-
  -  U-  -   SUS-
  S-  -  -   -  -   SUS-
  -  U -  US-   US-  -  US-   US-
  -  U-  -   SUS-
  S-  -  -   -  -   nUS	-
  US-
  -  U-  U -  X-   S-
  -  X-   S-
  -  nX4-  U-  S-
  $ )
Nro   rÕ   r×   rp   r-  ç      @rÖ   rØ   g      @r‡   )r%   rD   r£   ÚtermÚterm_2Údenominators         r/   ÚkurtosisÚ'betanbinom_gen._stats.<locals>.kurtosisÚ  sH  € Ø˜‘FˆDØ˜2‘v ‘l a¨¡e¨a°1°q±5¸2±:Ñ.>Ñ&>Ø˜a "™f™¨Ñ)ñ'*ñ +à˜Q ™U™
 q¨2¡v°°B±Ñ&6¸!¸b¹&Ø˜R™ñ:!Ø#$ñ:%ñ '%Ø')¨Q°©V°a©KÑ'7ñ'8ñ 9ñ9ð ˜Q ™V™ qÑ(Ø˜b™& A r¡EÑ)¨Q°©V¸¸B¹Ñ,?À!Ñ,CÑCØ˜a "™f r™\Ñ)ñ*ñ+ñ	+ˆFð  ™F q¨2¡vÑ.°Ñ2°QÑ6Ø™e b™jñ*Ø-.©U°R©Zñ9ˆKð ‘= ;Ñ.°Ñ3Ð3r3   rM   é   ©ÚxpxÚapply_wherer+   r,   )r.   r%   rD   r£   rs   r&  rt   ru   rv   rw   r/  r6  s               r/   r}   Úbetanbinom_gen._statsÉ  s»   € ò	$ä�_Š_˜Q ™U Q¨1 I¨tÄÇÁÑGˆò	1ô �oŠo˜a !™e a¨A Y°ÄÇÁÑGˆØ‰ˆò	!ð �'‹>Ü—’  Q¡¨¨q¨	°4ÄBÇFÁFÑKˆBò	4ð �'‹>Ü—’  Q¡¨¨q¨	°8ÌÏÉÑOˆBØ˜ˆÐr3   r‡   rm   rˆ   )r‹   rŒ   r�   rŽ   r�   r0   r:   r@   rO   rU   r}   r�   r‡   r3   r/   r  r  �  s'   † ñ#òHEô
:ò=ò=ò
-÷!r3   r  Ú
betanbinomc                   ó^   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rS rS rS rSrg)Úgeom_genið  aå  A geometric discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `geom` is:

.. math::

    f(k) = (1-p)^{k-1} p

for :math:`k \ge 1`, :math:`0 < p \leq 1`

`geom` takes :math:`p` as shape parameter,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

Note that when drawing random samples, the probability of observations that exceed
``np.iinfo(np.int64).max`` increases rapidly as $p$ decreases below $10^{-17}$. For
$p < 10^{-20}$, almost all observations would exceed the maximum ``int64``; however,
the output dtype is always ``int64``, so these values are clipped to the maximum.

%(after_notes)s

See Also
--------
planck

%(example)s

c                 ó    • [        SSSS5      /$ r—   r˜   r-   s    r/   r0   Úgeom_gen._shape_info  rš   r3   Nc                 ó¨   • UR                  XS9n[        R                  " UR                  5      R                  n[        R
                  " US:  XT5      $ )N©r8   r   )Ú	geometricr+   ÚiinforÛ   ÚmaxÚwhere)r.   r'   r8   r9   ÚresÚmax_ints         r/   r:   Úgeom_gen._rvs  sD   € Ø×$Ñ$ QÐ$Ð2ˆô —(’(˜3Ÿ9™9Ó%×)Ñ)ˆÜ�xŠx˜˜a™ Ó.Ð.r3   c                 ó   • US:*  US:„  -  $ ©Nr   r   r‡   r    s     r/   r@   Úgeom_gen._argcheck  s   € Ø�Q‘˜1˜q™5Ñ!Ð!r3   c                 óB   • [         R                  " SU-
  US-
  5      U-  $ rH   )r+   Úpower©r.   rM   r'   s      r/   rU   Úgeom_gen._pmf  s    € Ü�xŠx˜˜!™˜Q˜q™SÓ! AÑ%Ð%r3   c                 óP   • [         R                  " US-
  U* 5      [        U5      -   $ rH   )r   rK   r   rP  s      r/   rO   Úgeom_gen._logpmf"  s"   € Ü�Š˜q 1™u q bÓ)¬C°«FÑ2Ð2r3   c                 óJ   • [        U5      n[        [        U* 5      U-  5      * $ r5   )r   r   r   ©r.   rL   r'   rM   s       r/   rZ   Úgeom_gen._cdf%  s#   € Ü�!‹HˆÜ”e˜Q˜B“i ‘kÓ"Ð"Ð"r3   c                 óL   • [         R                  " U R                  X5      5      $ r5   )r+   r   Ú_logsfr¦   s      r/   r_   Úgeom_gen._sf)  s   € Ü�vŠv�d—k‘k !Ó'Ó(Ð(r3   c                 ó6   • [        U5      nU[        U* 5      -  $ r5   )r   r   rU  s       r/   rX  Úgeom_gen._logsf,  s   € Ü�!‹HˆØ”˜�r“‰{Ðr3   c                 ó¶   • [        [        U* 5      [        U* 5      -  5      nU R                  US-
  U5      n[        R                  " XA:¬  US:„  -  US-
  U5      $ rL  )r   r   rZ   r+   rG  )r.   ri   r'   r„   Útemps        r/   rj   Úgeom_gen._ppf0  sS   € Ü”E˜1˜"“I¤ q b£	Ñ)Ó*ˆØ�y‰y˜˜a™ Ó#ˆÜ�xŠx˜™ t¨a¡xÑ0°$°q±&¸$Ó?Ð?r3   c                 óŒ   • SU-  nSU-
  nX1-  U-  nSU-
  [        U5      -  n[        R                  " / SQU5      SU-
  -  nX$XV4$ )NrÕ   ro   )r   iúÿÿÿr×   )r   r+   Úpolyval)r.   r'   rt   Úqrru   rv   rw   s          r/   r}   Úgeom_gen._stats5  sT   € Ø�‰UˆØ�‰UˆØ‰f�q‰jˆØ�!‰e”t˜B“xÑˆÜ�ZŠZš
 AÓ&¨¨A©Ñ.ˆØ˜ˆÐr3   c                 ór   • [         R                  " U5      * [         R                  " U* 5      SU-
  -  U-  -
  $ r$  )r+   r   r   r    s     r/   r…   Úgeom_gen._entropy=  s/   € Ü—’�q“	ˆzœBŸHšH a R›L¨C°©EÑ2°QÑ6Ñ6Ð6r3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r:   r@   rU   rO   rZ   r_   rX  rj   r}   r…   r�   r‡   r3   r/   r?  r?  ð  s@   † ñòB>ô/ò"ò&ò3ò#ò)òò@ò
õ7r3   r?  ÚgeomzA geometric)rD   r’   Úlongnamec                   ód   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rS rS rS rS rSrg)Úhypergeom_geniD  a?  A hypergeometric discrete random variable.

The hypergeometric distribution models drawing objects from a bin.
`M` is the total number of objects, `n` is total number of Type I objects.
The random variate represents the number of Type I objects in `N` drawn
without replacement from the total population.

%(before_notes)s

Notes
-----
The symbols used to denote the shape parameters (`M`, `n`, and `N`) are not
universally accepted.  See the Examples for a clarification of the
definitions used here.

The probability mass function is defined as,

.. math:: p(k, M, n, N) = \frac{\binom{n}{k} \binom{M - n}{N - k}}
                               {\binom{M}{N}}

for :math:`k \in [\max(0, N - M + n), \min(n, N)]`, where the binomial
coefficients are defined as,

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

This distribution uses routines from the Boost Math C++ library for
the computation of the ``pmf``, ``cdf``, ``sf`` and ``stats`` methods. [1]_

%(after_notes)s

References
----------
.. [1] The Boost Developers. "Boost C++ Libraries". https://www.boost.org/.

Examples
--------
>>> import numpy as np
>>> from scipy.stats import hypergeom
>>> import matplotlib.pyplot as plt

Suppose we have a collection of 20 animals, of which 7 are dogs.  Then if
we want to know the probability of finding a given number of dogs if we
choose at random 12 of the 20 animals, we can initialize a frozen
distribution and plot the probability mass function:

>>> [M, n, N] = [20, 7, 12]
>>> rv = hypergeom(M, n, N)
>>> x = np.arange(0, n+1)
>>> pmf_dogs = rv.pmf(x)

>>> fig = plt.figure()
>>> ax = fig.add_subplot(111)
>>> ax.plot(x, pmf_dogs, 'bo')
>>> ax.vlines(x, 0, pmf_dogs, lw=2)
>>> ax.set_xlabel('# of dogs in our group of chosen animals')
>>> ax.set_ylabel('hypergeom PMF')
>>> plt.show()

Instead of using a frozen distribution we can also use `hypergeom`
methods directly.  To for example obtain the cumulative distribution
function, use:

>>> prb = hypergeom.cdf(x, M, n, N)

And to generate random numbers:

>>> R = hypergeom.rvs(M, n, N, size=10)

See Also
--------
nhypergeom, binom, nbinom

c                 ó´   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      [        SSS[        R                  4S5      /$ )NÚMTr   r&   r%   ÚNr*   r-   s    r/   r0   Úhypergeom_gen._shape_infoŽ  óP   € Ü˜3  q¬"¯&©& k°=ÓAÜ˜3  q¬"¯&©& k°=ÓAÜ˜3  q¬"¯&©& k°=ÓAðCð 	Cr3   Nc                 ó(   • UR                  X!U-
  X4S9$ ©NrC  )Úhypergeometric)r.   rj  r%   rk  r8   r9   s         r/   r:   Úhypergeom_gen._rvs“  s   € Ø×*Ñ*¨1°©c°1Ð*Ð@Ð@r3   c                 óf   • [         R                  " X1U-
  -
  S5      [         R                  " X#5      4$ rÅ   ©r+   ÚmaximumÚminimum)r.   rj  r%   rk  s       r/   rE   Úhypergeom_gen._get_support–  s'   € Ü�zŠz˜!˜q™S™' 1Ó%¤r§z¢z°!Ó'7Ð7Ð7r3   c                 óŒ   • US:„  US:¬  -  US:¬  -  nXBU:*  X1:*  -  -  nU[        U5      [        U5      -  [        U5      -  -  nU$ rÅ   r>   )r.   rj  r%   rk  rý   s        r/   r@   Úhypergeom_gen._argcheck™  sU   € Ø�A‘˜!˜q™&Ñ! Q¨!¡VÑ,ˆØ�a‘˜A™FÑ#Ñ#ˆØ”˜A“¤¨Q£Ñ/´+¸a³.Ñ@Ñ@ˆØˆr3   c                 óø   • X#peXV-
  n[        US-   S5      [        US-   S5      -   [        XT-
  S-   US-   5      -   [        US-   Xa-
  S-   5      -
  [        XA-
  S-   Xt-
  U-   S-   5      -
  [        US-   S5      -
  nU$ rH   ©r   )	r.   rM   rj  r%   rk  ÚtotÚgoodÚbadÚresults	            r/   rO   Úhypergeom_gen._logpmfŸ  s—   € ØˆTØ‰jˆÜ˜˜a™ Ó#¤f¨S°©U°AÓ&6Ñ6¼ÀÁÀaÁÈÈ1ÉÓ9MÑMÜ˜˜1™˜d™f Q™hÓ'ñ(Ü*0°±°Q±¸¹¸a¹À¹	Ó*BñCä˜˜Q™ Ó"ñ#ˆð ˆr3   c                 ó0   • [         R                  " XXB5      $ r5   )rR   Ú_hypergeom_pmf©r.   rM   rj  r%   rk  s        r/   rU   Úhypergeom_gen._pmf§  ó   € Ü×!Ò! !¨Ó-Ð-r3   c                 ó0   • [         R                  " XXB5      $ r5   )rR   Ú_hypergeom_cdfr‚  s        r/   rZ   Úhypergeom_gen._cdfª  r„  r3   c                 ón  • SU-  SU-  SU-  p2nX-
  nXS-   -  SU-  X-
  -  -
  SU-  U-  -
  nXQS-
  U-  U-  -  nUSU-  U-  X-
  -  U-  SU-  S-
  -  -  nXRU-  X-
  -  U-  US-
  -  US-
  -  -  n[         R                  " X#U5      [         R                  " X#U5      [         R                  " X#U5      U4$ )NrÕ   r   rp   r2  r×   ro   r-  )rR   Ú_hypergeom_meanÚ_hypergeom_varianceÚ_hypergeom_skewness)r.   rj  r%   rk  Úmrw   s         r/   r}   Úhypergeom_gen._stats­  sï   € Ø�q‘&˜"˜q™& " q¡&ˆaˆØ‰Eˆð �a‘%‰[˜2 ™6 Q¡UÑ+Ñ+¨b°1©f°q©jÑ8ˆØ
�1‰u˜‰k˜A‰oÑˆØ
ˆb�1‰f�q‰j˜A™EÑ" QÑ&¨"¨q©&°1©*Ñ5Ñ5ˆØ
�!‰e�q‘u‰o Ñ! Q¨¡VÑ,°°B±Ñ7Ñ7ˆä×Ò  aÓ(Ü×#Ò# A¨!Ó,Ü×#Ò# A¨!Ó,Øð	
ð 	
r3   c                 óª   • [         R                  X1U-
  -
  [        X#5      S-    nU R                  XAX#5      n[         R                  " [        U5      SS9$ )Nr   r   r€   )r+   r‚   ÚminÚpmfrƒ   r   )r.   rj  r%   rk  rM   r„   s         r/   r…   Úhypergeom_gen._entropy¾  sE   € Ü�E‰E�!˜1‘u‘+œc !›i¨!™mÐ,ˆØ�x‰x˜˜aÓ#ˆÜ�vŠv”d˜4“j qÑ)Ð)r3   c                 ó0   • [         R                  " XXB5      $ r5   )rR   Ú_hypergeom_sfr‚  s        r/   r_   Úhypergeom_gen._sfÃ  s   € Ü× Ò   qÓ,Ð,r3   c                 óª  • / n[        [        R                  " XX45      6  H›  u  pgp‰US-   US-   -  US-
  U	S-
  -  :  a6  UR                  [	        [        U R                  XgX‰5      5      * 5      5        MT  [        R                  " US-   U	S-   5      n
UR                  [        U R                  X§X‰5      5      5        M�     [        R                  " U5      $ )Nró   r   )Úzipr+   rú   Úappendr   r   rþ   Úaranger   rO   Úasarray©r.   rM   rj  r%   rk  rH  Úquantr{  r|  ÚdrawÚk2s              r/   rX  Úhypergeom_gen._logsfÆ  sµ   € ØˆÜ&)¬2×+>Ò+>¸qÀQÓ+JÓ&KÑ"ˆE˜Ø˜‘  c¡	Ñ*¨d°S©j¸TÀC¹ZÑ-HÓHà—
‘
œ5¤# d§k¡k°%¸dÓ&IÓ"JÐ!JÓKÖLô —Y’Y˜u q™y¨$°©(Ó3�Ø—
‘
œ9 T§\¡\°"¸4Ó%FÓGÖHñ 'Lô �zŠz˜#‹Ðr3   c                 ó¤  • / n[        [        R                  " XX45      6  H˜  u  pgp‰US-   US-   -  US-
  U	S-
  -  :”  a6  UR                  [	        [        U R                  XgX‰5      5      * 5      5        MT  [        R                  " SUS-   5      n
UR                  [        U R                  X§X‰5      5      5        Mš     [        R                  " U5      $ )Nró   r   r   )r–  r+   rú   r—  r   r   Úlogsfr˜  r   rO   r™  rš  s              r/   rÿ   Úhypergeom_gen._logcdfÒ  s±   € ØˆÜ&)¬2×+>Ò+>¸qÀQÓ+JÓ&KÑ"ˆE˜Ø˜‘  c¡	Ñ*¨d°S©j¸TÀC¹ZÑ-HÓHà—
‘
œ5¤# d§j¡j°¸TÓ&HÓ"IÐ!IÓJÖKô —Y’Y˜q %¨!¡)Ó,�Ø—
‘
œ9 T§\¡\°"¸4Ó%FÓGÖHñ 'Lô �zŠz˜#‹Ðr3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r:   rE   r@   rO   rU   rZ   r}   r…   r_   rX  rÿ   r�   r‡   r3   r/   rh  rh  D  sG   † ñHòRCô
Aò8òòò.ò.ò
ò"*ò
-ò
õ
r3   rh  Ú	hypergeomc                   óF   • \ rS rSrSrS rS rS rSS jrS r	S	 r
S
 rSrg)Únhypergeom_geniâ  a>  A negative hypergeometric discrete random variable.

Consider a box containing :math:`M` balls:, :math:`n` red and
:math:`M-n` blue. We randomly sample balls from the box, one
at a time and *without* replacement, until we have picked :math:`r`
blue balls. `nhypergeom` is the distribution of the number of
red balls :math:`k` we have picked.

%(before_notes)s

Notes
-----
The symbols used to denote the shape parameters (`M`, `n`, and `r`) are not
universally accepted. See the Examples for a clarification of the
definitions used here.

The probability mass function is defined as,

.. math:: f(k; M, n, r) = \frac{{{k+r-1}\choose{k}}{{M-r-k}\choose{n-k}}}
                               {{M \choose n}}

for :math:`k \in [0, n]`, :math:`n \in [0, M]`, :math:`r \in [0, M-n]`,
and the binomial coefficient is:

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

It is equivalent to observing :math:`k` successes in :math:`k+r-1`
samples with :math:`k+r`'th sample being a failure. The former
can be modelled as a hypergeometric distribution. The probability
of the latter is simply the number of failures remaining
:math:`M-n-(r-1)` divided by the size of the remaining population
:math:`M-(k+r-1)`. This relationship can be shown as:

.. math:: NHG(k;M,n,r) = HG(k;M,n,k+r-1)\frac{(M-n-(r-1))}{(M-(k+r-1))}

where :math:`NHG` is probability mass function (PMF) of the
negative hypergeometric distribution and :math:`HG` is the
PMF of the hypergeometric distribution.

%(after_notes)s

Examples
--------
>>> import numpy as np
>>> from scipy.stats import nhypergeom
>>> import matplotlib.pyplot as plt

Suppose we have a collection of 20 animals, of which 7 are dogs.
Then if we want to know the probability of finding a given number
of dogs (successes) in a sample with exactly 12 animals that
aren't dogs (failures), we can initialize a frozen distribution
and plot the probability mass function:

>>> M, n, r = [20, 7, 12]
>>> rv = nhypergeom(M, n, r)
>>> x = np.arange(0, n+2)
>>> pmf_dogs = rv.pmf(x)

>>> fig = plt.figure()
>>> ax = fig.add_subplot(111)
>>> ax.plot(x, pmf_dogs, 'bo')
>>> ax.vlines(x, 0, pmf_dogs, lw=2)
>>> ax.set_xlabel('# of dogs in our group with given 12 failures')
>>> ax.set_ylabel('nhypergeom PMF')
>>> plt.show()

Instead of using a frozen distribution we can also use `nhypergeom`
methods directly.  To for example obtain the probability mass
function, use:

>>> prb = nhypergeom.pmf(x, M, n, r)

And to generate random numbers:

>>> R = nhypergeom.rvs(M, n, r, size=10)

To verify the relationship between `hypergeom` and `nhypergeom`, use:

>>> from scipy.stats import hypergeom, nhypergeom
>>> M, n, r = 45, 13, 8
>>> k = 6
>>> nhypergeom.pmf(k, M, n, r)
0.06180776620271643
>>> hypergeom.pmf(k, M, n, k+r-1) * (M - n - (r-1)) / (M - (k+r-1))
0.06180776620271644

See Also
--------
hypergeom, binom, nbinom

References
----------
.. [1] Negative Hypergeometric Distribution on Wikipedia
       https://en.wikipedia.org/wiki/Negative_hypergeometric_distribution

.. [2] Negative Hypergeometric Distribution from
       http://www.math.wm.edu/~leemis/chart/UDR/PDFs/Negativehypergeometric.pdf

c                 ó´   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      [        SSS[        R                  4S5      /$ )Nrj  Tr   r&   r%   Úrr*   r-   s    r/   r0   Únhypergeom_gen._shape_infoG  rm  r3   c                 ó
   • SU4$ rÅ   r‡   )r.   rj  r%   r¦  s       r/   rE   Únhypergeom_gen._get_supportL  rÈ   r3   c                 ó‚   • US:¬  X!:*  -  US:¬  -  X1U-
  :*  -  nU[        U5      [        U5      -  [        U5      -  -  nU$ rÅ   r>   )r.   rj  r%   r¦  rý   s        r/   r@   Únhypergeom_gen._argcheckO  sK   € Ø�Q‘˜1™6Ñ" a¨1¡fÑ-°¸±c±Ñ:ˆØ”˜A“¤¨Q£Ñ/´+¸a³.Ñ@Ñ@ˆØˆr3   Nc                 ó2   ^ • [         U 4S j5       nU" XX4US9$ )Nc                 ó  >• TR                  XU5      u  pV[        R                  " XVS-   5      nTR                  XpX5      n[	        X‡SSS9n	U	" UR                  US95      R                  [        5      n
Uc  U
R                  5       $ U
$ )Nr   ÚnextÚextrapolate)Úkindr)  rC  )	Úsupportr+   r˜  rü   r
   ÚuniformrÚ   ÚintÚitem)rj  r%   r¦  r8   r9   rD   r£   Úksrü   ÚppfÚrvsr.   s              €r/   Ú_rvs1Ú"nhypergeom_gen._rvs.<locals>._rvs1V  s€   ø€ ð —<‘<  aÓ(‰DˆAÜ—’˜1 ™cÓ"ˆBØ—(‘(˜2 !Ó'ˆCÜ˜3¨¸MÑJˆCÙ�l×*Ñ*°Ð*Ð5Ó6×=Ñ=¼cÓBˆCØ‰|Ø—x‘x“zÐ!ØˆJr3   rœ   ©r   )r.   rj  r%   r¦  r8   r9   r¸  s   `      r/   r:   Únhypergeom_gen._rvsT  s&   ø€ ä	#ô		ó 
$ð		ñ �Q˜1°lÑCÐCr3   c                 óH   • [         R                  " US:g  US:g  -  XX44S SS9$ )Nr   c                 óè   • [        U S-   U5      * [        X-   S5      -   [        X -
  S-   X-
  U-
  S-   5      -
  [        X-
  U -
  S-   S5      -   [        US-   X-
  S-   5      -   [        US-   S5      -
  $ rH   rz  )rM   rj  r%   r¦  s       r/   Ú<lambda>Ú(nhypergeom_gen._logpmf.<locals>.<lambda>g  s�   € Ü˜˜1™˜a“.�¤6¨!©#¨q£>Ñ1Ü˜!™#˜a™% ¡ Q¡ q¡Ó)ñ*Ü,2°1±3°q±5¸±7¸AÓ,>ñ?ä˜!˜A™#˜q™s 1™uÓ%ñ&ä(.¨q°©s°A«ò7r3   ç        r(  )r:  r;  ©r.   rM   rj  r%   r¦  s        r/   rO   Únhypergeom_gen._logpmfd  s3   € Ü�ŠØ�!‰V˜˜Q™Ñ !¨ ñ8ð ñð 	r3   c                 ó8   • [        U R                  XX45      5      $ r5   rÐ   rÁ  s        r/   rU   Únhypergeom_gen._pmfm  s   € ô �4—<‘<  aÓ+Ó,Ð,r3   c                 ó–   • SU-  SU-  SU-  p2nX2-  X-
  S-   -  nX1S-   -  U-  X-
  S-   X-
  S-   -  -  SX1U-
  S-   -  -
  -  nSu  pgXEXg4$ )NrÕ   r   rÖ   rm   r‡   )r.   rj  r%   r¦  rt   ru   rv   rw   s           r/   r}   Únhypergeom_gen._statsr  sv   € ð �Q‘$˜˜1™˜b ™dˆaˆØ‰S�A‘C˜‘E‰]ˆà�1‘‰g�a‰i˜A™C ™E A¡C¨¡E™?Ñ+¨q°1¸!¹¸A¹±;©Ñ?ˆð ‰ˆØ˜ˆÐr3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   rE   r@   r:   rO   rU   r}   r�   r‡   r3   r/   r¤  r¤  â  s.   † ñbòHCò
òô
Dò ò-õ
r3   r¤  Ú
nhypergeomc                   ó@   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
rg)Ú
logser_geni„  a   A Logarithmic (Log-Series, Series) discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `logser` is:

.. math::

    f(k) = - \frac{p^k}{k \log(1-p)}

for :math:`k \ge 1`, :math:`0 < p < 1`

`logser` takes :math:`p` as shape parameter,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

%(after_notes)s

%(example)s

c                 ó    • [        SSSS5      /$ r—   r˜   r-   s    r/   r0   Úlogser_gen._shape_info�  rš   r3   Nc                 ó    • UR                  XS9$ ro  )Ú	logseriesr�   s       r/   r:   Úlogser_gen._rvs   s   € ð ×%Ñ% aÐ%Ð3Ð3r3   c                 ó   • US:„  US:  -  $ r=   r‡   r    s     r/   r@   Úlogser_gen._argcheck¥  s   € Ø�A‘˜!˜a™%Ñ Ð r3   c                 ól   • [         R                  " X!5      * S-  U-  [        R                  " U* 5      -  $ r$  )r+   rO  r   r   rP  s      r/   rU   Úlogser_gen._pmf¨  s,   € ä—’˜“ˆ Ñ$ qÑ(¬7¯=ª=¸!¸Ó+<Ñ<Ð<r3   c                 ó¢   • Sn[         R                  " US-   X25      * [         R                  " US-   U5      -  [        R                  " U* 5      -  $ )Ng0Žä.ÿ++r   )r   rõ   rÁ   r+   r   )r.   rM   r'   Útinys       r/   r_   Úlogser_gen._sf¬  sF   € Øˆô
 —’  !¡ TÓ-Ð-´·²¸Q¸q¹SÀ$Ó0GÑGÌ"Ï(Ê(ÐTUÐSUË,ÑVÐVr3   c                 ó¸  • [         R                  " U* 5      nXS-
  -  U-  nU* U-  US-
  S-  -  nXCU-  -
  nU* U-  SU-   -  SU-
  S-  -  nUSU-  U-  -
  SUS-  -  -   nU[        R                  " US5      -  nU* U-  SUS-
  S-  -  SU-  US-
  S-  -  -
  SU-  U-  US-
  S-  -  -   -  n	U	SU-  U-  -
  SU-  U-  U-  -   SUS-  -  -
  n
X¥S-  -  S-
  nX5X‹4$ )	NrÕ   rÖ   rØ   ç      ø?r   r×   r8  r-  )r   r   r+   rO  )r.   r'   r¦  rt   Úmu2pru   Úmu3pÚmu3rv   Úmu4pÚmu4rw   s               r/   r}   Úlogser_gen._stats´  s4  € Ü�MŠM˜1˜"ÓˆØ�c‘'‰]˜QÑˆØˆr�A‰v˜˜S™ 1™Ñ$ˆØ˜‘U‰lˆØˆr�A‰v˜˜Q™Ñ 3¨¡7¨Q¡,Ñ.ˆØ�Q�r‘T˜$‘YÑ  2 q¡5¡Ñ(ˆØ”2—8’8˜C Ó%Ñ%ˆàˆr�A‰vØ�1�Q‘3˜‘(‰N˜Q˜q™S A¨¡E¨A¡:Ñ-Ñ-°°!±°A±¸¸1¹¸q¹Ñ0@Ñ@ñBˆà�Q�t‘V˜B‘YÑ  4¡¨¡¨2¡Ñ-°°"°a±%±Ñ7ˆØ˜‘6‰\˜CÑˆØ˜ˆÐr3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r:   r@   rU   r_   r}   r�   r‡   r3   r/   rÉ  rÉ  „  s&   † ñò0>ô4ò
!ò=òWõr3   rÉ  ÚlogserzA logarithmicc                   óR   • \ rS rSrSrS rS rSS jrS rS r	S	 r
S
 rS rS rSrg)Úpoisson_geniÇ  ag  A Poisson discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `poisson` is:

.. math::

    f(k) = \exp(-\mu) \frac{\mu^k}{k!}

for :math:`k \ge 0`.

`poisson` takes :math:`\mu \geq 0` as shape parameter.
When :math:`\mu = 0`, the ``pmf`` method
returns ``1.0`` at quantile :math:`k = 0`.

%(after_notes)s

%(example)s

c                 ó@   • [        SSS[        R                  4S5      /$ )Nrt   Fr   r&   r*   r-   s    r/   r0   Úpoisson_gen._shape_infoà  s   € Ü˜4 ¨¬B¯F©F¨°]ÓCÐDÐDr3   c                 ó   • US:¬  $ rÅ   r‡   )r.   rt   s     r/   r@   Úpoisson_gen._argcheckä  s   € Ø�Q‰wˆr3   Nc                 ó$   • UR                  X5      $ r5   ©Úpoisson)r.   rt   r8   r9   s       r/   r:   Úpoisson_gen._rvsç  s   € Ø×#Ñ# BÓ-Ð-r3   c                 óV   • [         R                  " X5      [        US-   5      -
  U-
  nU$ rH   )r   rJ   rI   )r.   rM   rt   ÚPks       r/   rO   Úpoisson_gen._logpmfê  s'   € Ü�]Š]˜1Ó!¤E¨!¨a©%£LÑ0°2Ñ5ˆØˆ	r3   c                 ó6   • [        U R                  X5      5      $ r5   rÐ   )r.   rM   rt   s      r/   rU   Úpoisson_gen._pmfî  s   € ä�4—<‘< Ó&Ó'Ð'r3   c                 óD   • [        U5      n[        R                  " X25      $ r5   )r   r   Úpdtr©r.   rL   rt   rM   s       r/   rZ   Úpoisson_gen._cdfò  s   € Ü�!‹HˆÜ�|Š|˜AÓ"Ð"r3   c                 óD   • [        U5      n[        R                  " X25      $ r5   )r   r   Úpdtrcrð  s       r/   r_   Úpoisson_gen._sfö  s   € Ü�!‹HˆÜ�}Š}˜QÓ#Ð#r3   c                 óÒ   • [        [        R                  " X5      5      n[        R                  " US-
  S5      n[        R
                  " XB5      n[        R                  " XQ:¬  XC5      $ rL  )r   r   Úpdtrikr+   rt  rï  rG  )r.   ri   rt   r„   Úvals1r]  s         r/   rj   Úpoisson_gen._ppfú  sJ   € Ü”G—N’N 1Ó)Ó*ˆÜ—
’
˜4 !™8 QÓ'ˆÜ�|Š|˜EÓ&ˆÜ�xŠx˜™	 5Ó/Ð/r3   c                 óØ   • Un[         R                  " U5      nUS:„  n[        R                  " XCS [         R                  S9n[        R                  " XCS [         R                  S9nXXV4$ )Nr   c                 ó   • [        SU -  5      $ r$  r.  ©rL   s    r/   r¾  Ú$poisson_gen._stats.<locals>.<lambda>  s   € ¼¸SÀ¹U¼r3   r(  c                 ó   • SU -  $ r$  r‡   rû  s    r/   r¾  rü    s   € ¸¸Aºr3   )r+   r™  r:  r;  r,   )r.   rt   ru   ÚtmpÚ
mu_nonzerorv   rw   s          r/   r}   Úpoisson_gen._stats   sW   € ØˆÜ�jŠj˜‹nˆØ˜1‘Wˆ
Ü�_Š_˜ZÑ.CÔPR×PVÑPVÑWˆÜ�_Š_˜Z©oÌ"Ï&É&ÑQˆØ˜ˆÐr3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r@   r:   rO   rU   rZ   r_   rj   r}   r�   r‡   r3   r/   rà  rà  Ç  s5   † ñò0Eòô.òò(ò#ò$ò0õr3   rà  rç  z	A Poisson)r’   rf  c                   óX   • \ rS rSrSrS rS rS rS rS r	S r
S	 rSS jrS rS rSrg
)Ú
planck_geni  aÚ  A Planck discrete exponential random variable.

%(before_notes)s

Notes
-----
The probability mass function for `planck` is:

.. math::

    f(k) = (1-\exp(-\lambda)) \exp(-\lambda k)

for :math:`k \ge 0` and :math:`\lambda > 0`.

`planck` takes :math:`\lambda` as shape parameter. The Planck distribution
can be written as a geometric distribution (`geom`) with
:math:`p = 1 - \exp(-\lambda)` shifted by ``loc = -1``.

%(after_notes)s

See Also
--------
geom

%(example)s

c                 ó@   • [        SSS[        R                  4S5      /$ )NÚlambda_Fr   r½   r*   r-   s    r/   r0   Úplanck_gen._shape_info(  s   € Ü˜9 e¨a´·±¨[¸.ÓIÐJÐJr3   c                 ó   • US:„  $ rÅ   r‡   )r.   r  s     r/   r@   Úplanck_gen._argcheck+  s   € Ø˜‰{Ðr3   c                 ó<   • [        U* 5      * [        U* U-  5      -  $ r5   )r   r   )r.   rM   r  s      r/   rU   Úplanck_gen._pmf.  s    € Ü�w�h“Ð¤ W H¨Q¡J£Ñ/Ð/r3   c                 ó>   • [        U5      n[        U* US-   -  5      * $ rH   )r   r   ©r.   rL   r  rM   s       r/   rZ   Úplanck_gen._cdf1  s#   € Ü�!‹HˆÜ�w�h  !¡‘nÓ%Ð%Ð%r3   c                 ó6   • [        U R                  X5      5      $ r5   )r   rX  )r.   rL   r  s      r/   r_   Úplanck_gen._sf5  s   € Ü�4—;‘;˜qÓ*Ó+Ð+r3   c                 ó*   • [        U5      nU* US-   -  $ rH   ©r   r  s       r/   rX  Úplanck_gen._logsf8  s   € Ü�!‹HˆØˆx˜˜1™‰~Ðr3   c                 óÔ   • [        SU-  [        U* 5      -  S-
  5      nUS-
  R                  " U R                  U5      6 nU R	                  XB5      n[
        R                  " XQ:¬  XC5      $ )Nç      ð¿r   )r   r   ÚcliprE   rZ   r+   rG  )r.   ri   r  r„   r÷  r]  s         r/   rj   Úplanck_gen._ppf<  s^   € Ü�D˜‘L¤5¨!¨£9Ñ,¨QÑ.Ó/ˆØ�a‘—’ × 1Ñ 1°'Ó :Ð<ˆØ�y‰y˜Ó(ˆÜ�xŠx˜™	 5Ó/Ð/r3   Nc                 ó@   • [        U* 5      * nUR                  XBS9S-
  $ )NrC  rÕ   )r   rD  )r.   r  r8   r9   r'   s        r/   r:   Úplanck_gen._rvsB  s)   € ä�G�8‹_ÐˆØ×%Ñ% aÐ%Ð3°cÑ9Ð9r3   c                 ó¢   • S[        U5      -  n[        U* 5      [        U* 5      S-  -  nS[        US-  5      -  nSS[        U5      -  -   nX#XE4$ )Nr   rÖ   ro   r8  )r   r   r   )r.   r  rt   ru   rv   rw   s         r/   r}   Úplanck_gen._statsG  sZ   € ØŒu�W‹~ÑˆÜ�7�(‹mœU G 8›_¨qÑ0Ñ0ˆØŒt�G˜C‘KÓ Ñ ˆØˆq”�g“‰ÑˆØ˜ˆÐr3   c                 óX   • [        U* 5      * nU[        U* 5      -  U-  [        U5      -
  $ r5   )r   r   r   )r.   r  ÚCs      r/   r…   Úplanck_gen._entropyN  s/   € Ü�G�8‹_ÐˆØ”s˜G˜8“}Ñ$ QÑ&¬¨Q«Ñ/Ð/r3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r@   rU   rZ   r_   rX  rj   r:   r}   r…   r�   r‡   r3   r/   r  r    s:   † ñò6Kòò0ò&ò,òò0ô:ò
õ0r3   r  ÚplanckzA discrete exponential c                   óB   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
rg)Úboltzmann_geniV  ak  A Boltzmann (Truncated Discrete Exponential) random variable.

%(before_notes)s

Notes
-----
The probability mass function for `boltzmann` is:

.. math::

    f(k) = (1-\exp(-\lambda)) \exp(-\lambda k) / (1-\exp(-\lambda N))

for :math:`k = 0,..., N-1`.

`boltzmann` takes :math:`\lambda > 0` and :math:`N > 0` as shape parameters.

%(after_notes)s

%(example)s

c                 óz   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      /$ )Nr  Fr   r½   rk  Tr*   r-   s    r/   r0   Úboltzmann_gen._shape_infol  s:   € Ü˜9 e¨a´·±¨[¸.ÓIÜ˜3  q¬"¯&©& k°>ÓBðDð 	Dr3   c                 ó0   • US:„  US:„  -  [        U5      -  $ rÅ   r>   ©r.   r  rk  s      r/   r@   Úboltzmann_gen._argcheckp  s   € Ø˜!‘  A¡Ñ&¬°Q«Ñ7Ð7r3   c                 ó$   • U R                   US-
  4$ rH   rC   r#  s      r/   rE   Úboltzmann_gen._get_supports  s   € Ø�v‰v�q˜1‘uˆ}Ðr3   c                 ój   • S[        U* 5      -
  S[        U* U-  5      -
  -  nU[        U* U-  5      -  $ rH   ©r   )r.   rM   r  rk  Úfacts        r/   rU   Úboltzmann_gen._pmfv  s<   € ð ”#�w�h“-‘ !¤C¨¨°©
£OÑ"3Ñ4ˆØ”C˜˜ ™
“OÑ#Ð#r3   c                 óh   • [        U5      nS[        U* US-   -  5      -
  S[        U* U-  5      -
  -  $ rH   )r   r   )r.   rL   r  rk  rM   s        r/   rZ   Úboltzmann_gen._cdf|  s9   € Ü�!‹HˆØ”#�w�h  !¡‘nÓ%Ñ%¨¬#¨w¨h°q©j«/Ñ(9Ñ:Ð:r3   c                 ó  • US[        U* U-  5      -
  -  n[        SU-  [        SU-
  5      -  S-
  5      nUS-
  R                  S[        R
                  5      nU R                  XbU5      n[        R                  " Xq:¬  Xe5      $ )Nr   r  rÀ  )r   r   r   r  r+   r,   rZ   rG  )r.   ri   r  rk  Úqnewr„   r÷  r]  s           r/   rj   Úboltzmann_gen._ppf€  sv   € Ø�!”C˜˜ ™
“OÑ#Ñ$ˆÜ�D˜‘L¤3 q¨¡v£;Ñ.¨qÑ0Ó1ˆØ�a‘—‘˜c¤2§6¡6Ó*ˆØ�y‰y˜¨Ó+ˆÜ�xŠx˜™	 5Ó/Ð/r3   c                 ó‚  • [        U* 5      n[        U* U-  5      nUSU-
  -  X$-  SU-
  -  -
  nUSU-
  S-  -  X"-  U-  SU-
  S-  -  -
  nSU-
  SU-
  -  nX7S-  -  X"-  U-  -
  nUSU-   -  US-  -  US-  U-  SU-   -  -
  n	X˜S-  -  n	USSU-  -   X3-  -   -  US-  -  US-  U-  SSU-  -   XD-  -   -  -
  n
X¨-  U-  n
XVXš4$ )NrÕ   r   rÖ   rØ   r×  r8  r(  )r.   r  rk  ÚzÚzNrt   ru   ÚtrmÚtrm2rv   rw   s              r/   r}   Úboltzmann_gen._stats‡  s  € Ü��‹MˆÜ�'�˜!‘‹_ˆØ��A‘‰Y�q‘t˜Q˜r™T‘{Ñ"ˆØ��Q‘˜‘
‰l˜Q™S ™V Q r¡T¨A¡IÑ-Ñ-ˆØ�‰t�a˜‘c‰lˆØ�q‘&‘˜1™3˜r™6Ñ!ˆØ��!‘‰W�S˜!‘V‰^˜a ™d 2™g q¨¡t™nÑ,ˆØ˜‘+ÑˆØ��!�A‘#‘�a‘c‘	‰]˜3 ™6Ñ! A q¡D¨2¡I¨q°°2±©v°b±e©|Ñ$<Ñ<ˆØ‰Y˜ÑˆØ˜ˆÐr3   r‡   N)r‹   rŒ   r�   rŽ   r�   r0   r@   rE   rU   rZ   rj   r}   r�   r‡   r3   r/   r  r  V  s+   † ñò*Dò8òò$ò;ò0õr3   r  Ú	boltzmannz!A truncated discrete exponential )r’   rD   rf  c                   óR   • \ rS rSrSrS rS rS rS rS r	S r
S	 rSS jrS rSrg
)Úrandint_geni™  a+  A uniform discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `randint` is:

.. math::

    f(k) = \frac{1}{\texttt{high} - \texttt{low}}

for :math:`k \in \{\texttt{low}, \dots, \texttt{high} - 1\}`.

`randint` takes :math:`\texttt{low}` and :math:`\texttt{high}` as shape
parameters.

%(after_notes)s

Examples
--------
>>> import numpy as np
>>> from scipy.stats import randint
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots(1, 1)

Calculate the first four moments:

>>> low, high = 7, 31
>>> mean, var, skew, kurt = randint.stats(low, high, moments='mvsk')

Display the probability mass function (``pmf``):

>>> x = np.arange(low - 5, high + 5)
>>> ax.plot(x, randint.pmf(x, low, high), 'bo', ms=8, label='randint pmf')
>>> ax.vlines(x, 0, randint.pmf(x, low, high), colors='b', lw=5, alpha=0.5)

Alternatively, the distribution object can be called (as a function) to
fix the shape and location. This returns a "frozen" RV object holding the
given parameters fixed.

Freeze the distribution and display the frozen ``pmf``:

>>> rv = randint(low, high)
>>> ax.vlines(x, 0, rv.pmf(x), colors='k', linestyles='-',
...           lw=1, label='frozen pmf')
>>> ax.legend(loc='lower center')
>>> plt.show()

Check the relationship between the cumulative distribution function
(``cdf``) and its inverse, the percent point function (``ppf``):

>>> q = np.arange(low, high)
>>> p = randint.cdf(q, low, high)
>>> np.allclose(q, randint.ppf(p, low, high))
True

Generate random numbers:

>>> r = randint.rvs(low, high, size=1000)

c                 ó¶   • [        SS[        R                  * [        R                  4S5      [        SS[        R                  * [        R                  4S5      /$ )NÚlowTr½   Úhighr*   r-   s    r/   r0   Úrandint_gen._shape_infoÙ  sH   € Ü˜5 $¬"¯&©&¨´"·&±&Ð(9¸>ÓJÜ˜6 4¬2¯6©6¨'´2·6±6Ð):¸NÓKðMð 	Mr3   c                 ó:   • X!:„  [        U5      -  [        U5      -  $ r5   r>   ©r.   r:  r;  s      r/   r@   Úrandint_gen._argcheckÝ  s   € Ø‘
œk¨#Ó.Ñ.´¸TÓ1BÑBÐBr3   c                 ó   • XS-
  4$ rH   r‡   r>  s      r/   rE   Úrandint_gen._get_supportà  s   € Ø˜‘Fˆ{Ðr3   c                 óº   • [         R                  " U5      [         R                  " U[         R                  S9U-
  -  n[         R                  " X:¬  X:  -  US5      $ )N©rÛ   rÀ  )r+   Ú	ones_liker™  Úint64rG  )r.   rM   r:  r;  r'   s        r/   rU   Úrandint_gen._pmfã  sD   € ä�LŠL˜‹OœrŸzšz¨$´b·h±hÑ?À#ÑEÑFˆÜ�xŠx˜™ a¡hÑ/°°BÓ7Ð7r3   c                 ó0   • [        U5      nXB-
  S-   X2-
  -  $ r$  r  )r.   rL   r:  r;  rM   s        r/   rZ   Úrandint_gen._cdfè  s   € Ü�!‹HˆØ‘˜"‘ ¡Ñ,Ð,r3   c                 ó¬   • [        XU-
  -  U-   5      S-
  nUS-
  R                  X#5      nU R                  XRU5      n[        R                  " Xa:¬  XT5      $ rH   )r   r  rZ   r+   rG  )r.   ri   r:  r;  r„   r÷  r]  s          r/   rj   Úrandint_gen._ppfì  sR   € Ü�A ™Ñ$ sÑ*Ó+¨aÑ/ˆØ˜‘—‘ Ó*ˆØ�y‰y˜ TÓ*ˆÜ�xŠx˜™	 5Ó/Ð/r3   c                 ó¸   • [         R                  " U5      [         R                  " U5      pCX4-   S-
  S-  nX4-
  nXf-  S-
  S-  nSnSXf-  S-   -  Xf-  S-
  -  n	XWX‰4$ )NrÕ   rÖ   r   g      (@rÀ  g333333ó¿)r+   r™  )
r.   r:  r;  Úm2Úm1rt   Údru   rv   rw   s
             r/   r}   Úrandint_gen._statsò  sk   € Ü—’˜DÓ!¤2§:¢:¨c£?ˆBØ‰g˜‰m˜qÑ ˆØ‰GˆØ‰s�Q‰w˜$ÑˆØˆØ˜™˜s™Ñ# q¡s¨S¡yÑ1ˆØ˜ˆÐr3   Nc                 óŒ  • [         R                  " U5      R                  S:X  a.  [         R                  " U5      R                  S:X  a
  [        XAX#S9$ Ub,  [         R                  " X5      n[         R                  " X#5      n[         R
                  " [        [        U5      [         R                  " [        5      /S9nU" X5      $ )z=An array of *size* random integers >= ``low`` and < ``high``.r   rC  )Úotypes)	r+   r™  r8   r	   Úbroadcast_toÚ	vectorizer   rÛ   r³  )r.   r:  r;  r8   r9   Úrandints         r/   r:   Úrandint_gen._rvsû  sŽ   € ä�:Š:�c‹?×Ñ 1Ó$¬¯ª°DÓ)9×)>Ñ)>À!Ó)Cä °4ÑCÐCàÑô
 —/’/ #Ó,ˆCÜ—?’? 4Ó.ˆDÜ—,’,œw¤|°\ÓBÜ')§x¢x´£} oñ7ˆá�sÓ!Ð!r3   c                 ó   • [        X!-
  5      $ r5   )r   r>  s      r/   r…   Úrandint_gen._entropy  s   € Ü�4‘:‹Ðr3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r@   rE   rU   rZ   rj   r}   r:   r…   r�   r‡   r3   r/   r8  r8  ™  s7   † ñ=ò~MòCòò8ò
-ò0òô"õ"r3   r8  rT  z#A discrete uniform (random integer)c                   ó:   • \ rS rSrSrS rS
S jrS rS rS r	S	r
g)Úzipf_geni  aA  A Zipf (Zeta) discrete random variable.

%(before_notes)s

See Also
--------
zipfian

Notes
-----
The probability mass function for `zipf` is:

.. math::

    f(k, a) = \frac{1}{\zeta(a) k^a}

for :math:`k \ge 1`, :math:`a > 1`.

`zipf` takes :math:`a > 1` as shape parameter. :math:`\zeta` is the
Riemann zeta function (`scipy.special.zeta`)

The Zipf distribution is also known as the zeta distribution, which is
a special case of the Zipfian distribution (`zipfian`).

%(after_notes)s

References
----------
.. [1] "Zeta Distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Zeta_distribution

%(example)s

Confirm that `zipf` is the large `n` limit of `zipfian`.

>>> import numpy as np
>>> from scipy.stats import zipf, zipfian
>>> k = np.arange(11)
>>> np.allclose(zipf.pmf(k, a), zipfian.pmf(k, a, n=10000000))
True

c                 ó@   • [        SSS[        R                  4S5      /$ )NrD   Fr   r½   r*   r-   s    r/   r0   Úzipf_gen._shape_infoA  ó   € Ü˜3 ¨¬2¯6©6 {°NÓCÐDÐDr3   Nc                 ó    • UR                  XS9$ ro  )Úzipf)r.   rD   r8   r9   s       r/   r:   Úzipf_gen._rvsD  s   € Ø× Ñ  Ð Ð.Ð.r3   c                 ó   • US:„  $ rH   r‡   ©r.   rD   s     r/   r@   Úzipf_gen._argcheckG  s   € Ø�1‰uˆr3   c                 ó„   • UR                  [        R                  5      nS[        R                  " US5      -  X* -  -  nU$ ©NrÕ   r   )rÚ   r+   Úfloat64r   Úzeta)r.   rM   rD   rê  s       r/   rU   Úzipf_gen._pmfJ  s7   € Ø�H‰H”R—Z‘ZÓ ˆà”7—<’<  1Ó%Ñ%¨¨2©Ñ-ˆØˆ	r3   c                 óZ   • [         R                  " X!S-   :„  X!4S [        R                  S9$ )Nr   c                 ód   • [         R                  " X-
  S5      [         R                  " U S5      -  $ rH   )r   rf  )rD   r%   s     r/   r¾  Ú zipf_gen._munp.<locals>.<lambda>S  s!   € œŸš a¡e¨QÓ/´'·,²,¸qÀ!Ó2DÒDr3   r(  r9  )r.   r%   rD   s      r/   Ú_munpÚzipf_gen._munpP  s*   € Ü�ŠØ�A‘‰I˜�vÙDÜ—v‘vñð 	r3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r:   r@   rU   rk  r�   r‡   r3   r/   rY  rY    s"   † ñ)òVEô/òòõr3   rY  r^  zA Zipfc                   óB   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
rg)Úzipfian_geniZ  aÜ  A Zipfian discrete random variable.

%(before_notes)s

See Also
--------
zipf

Notes
-----
The probability mass function for `zipfian` is:

.. math::

    f(k, a, n) = \frac{1}{H_{n,a} k^a}

for :math:`k \in \{1, 2, \dots, n-1, n\}`, :math:`a \ge 0`,
:math:`n \in \{1, 2, 3, \dots\}`.

`zipfian` takes :math:`a` and :math:`n` as shape parameters.
:math:`H_{n,a}` is the :math:`n`:sup:`th` generalized harmonic
number of order :math:`a`.

The SciPy implementation of this distribution requires :math:`1 \le n \le 2^{53}`.
For larger values of :math:`n`, the `zipfian` methods (`pmf`, `cdf`, `mean`, etc.)
will return `nan`.

When :math:`a > 1`, the Zipfian distribution reduces to the Zipf (zeta)
distribution as :math:`n \rightarrow \infty`.

%(after_notes)s

References
----------
.. [1] "Zipf's Law", Wikipedia, https://en.wikipedia.org/wiki/Zipf's_law
.. [2] Larry Leemis, "Zipf Distribution", Univariate Distribution
       Relationships. http://www.math.wm.edu/~leemis/chart/UDR/PDFs/Zipf.pdf

%(example)s

Confirm that `zipfian` reduces to `zipf` for large `n`, ``a > 1``.

>>> import numpy as np
>>> from scipy.stats import zipf, zipfian
>>> k = np.arange(11)
>>> np.allclose(zipfian.pmf(k, a=3.5, n=10000000), zipf.pmf(k, a=3.5))
True

c                 óz   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      /$ )NrD   Fr   r&   r%   Tr½   r*   r-   s    r/   r0   Úzipfian_gen._shape_info�  s:   € Ü˜3 ¨¬2¯6©6 {°MÓBÜ˜3  q¬"¯&©& k°>ÓBðDð 	Dr3   c           	      ó¢   • US:¬  U[         R                  " [         R                  " USS5      5      R                  [         R                  S9:H  -  $ )Nr   r   l          rC  )r+   r™  r  rÚ   rE  ©r.   rD   r%   s      r/   r@   Úzipfian_gen._argcheck‘  sG   € ð �a‘Ø”b—j’j¤§¢¨¨A¨uÓ!5Ó6×=Ñ=ÄBÇHÁHÐ=ÐMÑMñOð 	Pr3   c                 ó2   • S[         R                  " U5      4$ rH   )r+   r   rr  s      r/   rE   Úzipfian_gen._get_support¡  s   € Ø”"—(’(˜1“+ˆ~Ðr3   c                 óˆ   • [         R                  " U5      n[         R                  " U5      n[        R                  " XX25      $ r5   ©r+   r   rR   Ú_normalized_gen_harmonic©r.   rM   rD   r%   s       r/   rU   Úzipfian_gen._pmf¤  s/   € Ü�HŠH�Q‹KˆÜ�HŠH�Q‹KˆÜ×+Ò+¨A°!Ó7Ð7r3   c                 óŠ   • [         R                  " U5      n[         R                  " U5      n[        R                  " SXU5      $ rH   rw  ry  s       r/   rZ   Úzipfian_gen._cdf©  s1   € Ü�HŠH�Q‹KˆÜ�HŠH�Q‹KˆÜ×+Ò+¨A¨q°QÓ7Ð7r3   c                 ó�   • [         R                  " U5      n[         R                  " U5      n[        R                  " US-   X3U5      $ rH   rw  ry  s       r/   r_   Úzipfian_gen._sf®  s5   € Ü�HŠH�Q‹KˆÜ�HŠH�Q‹KˆÜ×+Ò+¨A°©E°1¸Ó;Ð;r3   c                 ó  • [         R                  " U5      n[        R                  " X!5      n[        R                  " X!S-
  5      n[        R                  " X!S-
  5      n[        R                  " X!S-
  5      n[        R                  " X!S-
  5      nXC-  nXS-  US-  -
  n	US-  n
Xš-  nXc-  SU-  U-  US-  -  -
  SUS-  -  US-  -  -   US-  -  nUS-  U-  SUS-  -  U-  U-  -
  SU-  US-  -  U-  -   SUS-  -  -
  U	S-  -  nUS-  nX‹XÍ4$ )Nr   rÖ   rØ   r8  r×  r×   )r+   r   rR   Ú_gen_harmonic)r.   rD   r%   ÚHnaÚHna1ÚHna2ÚHna3ÚHna4Úmu1Úmu2nÚmu2dÚmu2rv   rw   s                 r/   r}   Úzipfian_gen._stats³  s;  € Ü�HŠH�Q‹Kˆä×Ò Ó%ˆÜ× Ò   a¡CÓ(ˆÜ× Ò   a¡CÓ(ˆÜ× Ò   a¡CÓ(ˆÜ× Ò   a¡CÓ(ˆØ‰hˆØ‘˜4 ™7Ñ"ˆØ�A‰vˆØ‰kˆØ‰h˜˜4™ ™ S¨!¡VÑ+Ñ+¨a°°a±©i¸¸Q¹Ñ.>Ñ>ÀÀcÁ
ÑJˆØ�1‰f�T‰k˜A˜c 1™f™H T™M¨$Ñ.Ñ.°°3±°t¸Q±w±¸tÑ1CÑCØ�$˜‘'‘	ñØ! 1™Wñ%ˆà
ˆa‰ˆØ˜ÐÐr3   r‡   N)r‹   rŒ   r�   rŽ   r�   r0   r@   rE   rU   rZ   r_   r}   r�   r‡   r3   r/   rn  rn  Z  s-   † ñ0òdDòPò ò8ò
8ò
<õ
 r3   rn  Úzipfianz	A Zipfianc                   óF   • \ rS rSrSrS rS rS rS rS r	S r
SS
 jrSrg	)Údlaplace_geniÉ  a   A  Laplacian discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `dlaplace` is:

.. math::

    f(k) = \tanh(a/2) \exp(-a |k|)

for integers :math:`k` and :math:`a > 0`.

`dlaplace` takes :math:`a` as shape parameter.

%(after_notes)s

%(example)s

c                 ó@   • [        SSS[        R                  4S5      /$ )NrD   Fr   r½   r*   r-   s    r/   r0   Údlaplace_gen._shape_infoà  r\  r3   c                 óP   • [        US-  5      [        U* [        U5      -  5      -  $ ©Nro   )r   r   Úabs)r.   rM   rD   s      r/   rU   Údlaplace_gen._pmfã  s$   € ä�A�c‘E‹{œS ! ¤c¨!£f¡Ó-Ñ-Ð-r3   c                 ó\   • [        U5      nS nS n[        R                  " US:¬  X24XE5      $ )Nc                 óD   • S[        U* U -  5      [        U5      S-   -  -
  $ rd  r(  ©rM   rD   s     r/   rö   Údlaplace_gen._cdf.<locals>.f1ê  s$   € Øœ˜a˜R !™V›¬¨A«°©
Ñ3Ñ3Ð3r3   c                 ó@   • [        XS-   -  5      [        U5      S-   -  $ rH   r(  r–  s     r/   Úf2Údlaplace_gen._cdf.<locals>.f2í  s    € Ü�q ™E‘{Ó#¤s¨1£v°¡zÑ2Ð2r3   r   )r   r:  r;  )r.   rL   rD   rM   rö   r™  s         r/   rZ   Údlaplace_gen._cdfç  s0   € Ü�!‹Hˆò	4ò	3ô �Š˜q A™v¨ v¨rÓ6Ð6r3   c           
      ó*  • S[        U5      -   n[        [        R                  " USS[        U* 5      -   -  :  [	        X-  5      U-  S-
  [	        SU-
  U-  5      * U-  5      5      nUS-
  n[        R                  " U R                  XR5      U:¬  XT5      $ )Nr   rÕ   )r   r   r+   rG  r   rZ   )r.   ri   rD   Úconstr„   r÷  s         r/   rj   Údlaplace_gen._ppfò  s�   € Ø”C˜“F‘
ˆÜ”B—H’H˜Q ¨¬C°°«G©Ñ!4Ñ4Ü  ¡›\¨AÑ-°Ñ1Ü! 1 Q¡3¨%¡-Ó0Ð0°1Ñ4ó6ó 7ˆð �q‘ˆÜ�xŠx˜Ÿ	™	 %Ó+¨qÑ0°%Ó>Ð>r3   c                 óŠ   • [        U5      nSU-  US-
  S-  -  nSU-  US-  SU-  -   S-   -  US-
  S-  -  nSUSXCS-  -  S-
  4$ )Nro   rÕ   rÖ   g      $@r8  rÀ  r-  r(  )r.   rD   Úear‰  rÜ  s        r/   r}   Údlaplace_gen._statsú  se   € Ü�‹VˆØ�‰e�R˜‘U˜Q‘JÑˆØ�‰e�R˜‘U˜3˜r™6‘\ "‘_Ñ%¨¨B©°©
Ñ2ˆØ�3˜˜C Q¡™J¨™OÐ+Ð+r3   c                 óN   • U[        U5      -  [        [        US-  5      5      -
  $ r‘  )r   r   r   ra  s     r/   r…   Údlaplace_gen._entropy   s"   € Ø”4˜“7‰{œS¤ a¨¡e£Ó-Ñ-Ð-r3   Nc                 óž   • [         R                  " [         R                  " U5      * 5      * nUR                  XBS9nUR                  XBS9nXV-
  $ ro  )r+   r   r™  rD  )r.   rD   r8   r9   ÚprobOfSuccessrL   Úys          r/   r:   Údlaplace_gen._rvs  sL   € ô  Ÿš¤2§:¢:¨a£= .Ó1Ð1ˆØ×"Ñ" =Ð"Ð<ˆØ×"Ñ" =Ð"Ð<ˆØ‰uˆr3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   rU   rZ   rj   r}   r…   r:   r�   r‡   r3   r/   r�  r�  É  s+   † ñò,Eò.ò	7ò?ò,ò.÷r3   r�  ÚdlaplacezA discrete Laplacianc                   óR   • \ rS rSrSrS rS rSSS.S jrS rS	 r	S
 r
S rS rSrg)Úpoisson_binom_geni  uü  A Poisson Binomial discrete random variable.

%(before_notes)s

See Also
--------
binom

Notes
-----
The probability mass function for `poisson_binom` is:

.. math::

 f(k; p_1, p_2, ..., p_n) = \sum_{A \in F_k} \prod_{i \in A} p_i \prod_{j \in A^C} 1 - p_j

where :math:`k \in \{0, 1, \dots, n-1, n\}`, :math:`F_k` is the set of all
subsets of :math:`k` integers that can be selected :math:`\{0, 1, \dots, n-1, n\}`,
and :math:`A^C` is the complement of a set :math:`A`.

`poisson_binom` accepts a single array argument ``p`` for shape parameters
:math:`0 â‰¤ p_i â‰¤ 1`, where the last axis corresponds with the index :math:`i` and
any others are for batch dimensions. Broadcasting behaves according to the usual
rules except that the last axis of ``p`` is ignored. Instances of this class do
not support serialization/unserialization.

%(after_notes)s

References
----------
.. [1] "Poisson binomial distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Poisson_binomial_distribution
.. [2] Biscarri, William, Sihai Dave Zhao, and Robert J. Brunner. "A simple and
       fast method for computing the Poisson binomial distribution function".
       Computational Statistics & Data Analysis 122 (2018) 92-100.
       :doi:`10.1016/j.csda.2018.01.007`

%(example)s

c                 ó   • / $ r5   r‡   r-   s    r/   r0   Úpoisson_binom_gen._shape_infoF  s	   € ð ˆ	r3   c                 ól   • [         R                  " USS9nSU:*  US:*  -  n[         R                  " USS9$ ©Nr   r€   r   )r+   ÚstackÚall)r.   Úargsr'   Úcondss       r/   r@   Úpoisson_binom_gen._argcheckK  s5   € Ü�HŠH�T Ñ"ˆØ�a‘˜A ™FÑ#ˆÜ�vŠv�e !Ñ$Ð$r3   Nrœ   c                ó(  • [         R                  " USS9nUc  UR                  O,[         R                  " U5      (       a  US4O[	        U5      S-   n[         R
                  " UR                  U5      n[        R                  XAUS9R                  SS9$ )Néÿÿÿÿr€   r   )r   rœ   )	r+   r¯  ÚshapeÚisscalarÚtupleÚbroadcast_shapesr·   r:   rƒ   )r.   r8   r9   r±  r'   s        r/   r:   Úpoisson_binom_gen._rvsP  s|   € ä�HŠH�T Ñ#ˆð  ™<�—’ÜŸ[š[¨×.Ñ.��q‘	´E¸$³KÀ$Ñ4Fð 	ä×"Ò" 1§7¡7¨DÓ1ˆÜ�~‰~˜a¸ˆ~ÐF×JÑJÐPRÐJÐSÐSr3   c                 ó   • S[        U5      4$ rÅ   )Úlen)r.   r±  s     r/   rE   Úpoisson_binom_gen._get_supportZ  s   € Ø”#�d“)ˆ|Ðr3   c                 óö   • [         R                  " U5      R                  [         R                  5      n[         R                  " U/UQ76 tp[         R
                  " U[         R                  S9n[        XS5      $ )NrC  r�  ©r+   Ú
atleast_1drÚ   rE  rú   r™  re  r   ©r.   rM   r±  s      r/   rU   Úpoisson_binom_gen._pmf]  óW   € Ü�MŠM˜!Ó×#Ñ#¤B§H¡HÓ-ˆÜ×&Ò& qÐ0¨4Ò0ˆˆÜ�zŠz˜$¤b§j¡jÑ1ˆÜ˜a uÓ-Ð-r3   c                 óö   • [         R                  " U5      R                  [         R                  5      n[         R                  " U/UQ76 tp[         R
                  " U[         R                  S9n[        XS5      $ )NrC  rü   r¿  rÁ  s      r/   rZ   Úpoisson_binom_gen._cdfc  rÃ  r3   c                 ó–   • [         R                  " USS9n[         R                  " USS9n[         R                  " USU-
  -  SS9nXES S 4$ r®  )r+   r¯  rƒ   )r.   r±  Úkwdsr'   r&  ru   s         r/   r}   Úpoisson_binom_gen._statsi  sG   € Ü�HŠH�T Ñ"ˆÜ�vŠv�a˜aÑ ˆÜ�fŠf�Q˜!˜A™#‘Y QÑ'ˆØ˜4 Ð&Ð&r3   c                 ó    • [        U /UQ70 UD6$ r5   )Úpoisson_binomial_frozen)r.   r±  rÇ  s      r/   Ú__call__Úpoisson_binom_gen.__call__o  s   € Ü& tÐ;¨dÒ;°dÑ;Ð;r3   r‡   )r‹   rŒ   r�   rŽ   r�   r0   r@   r:   rE   rU   rZ   r}   rË  r�   r‡   r3   r/   rª  rª    s8   † ñ'òPò
%ð
  $°$õ Tòò.ò.ò'õ<r3   rª  Úpoisson_binomzA Poisson binomialr'   )r’   rf  Úshapesc                 óL   • [        [        R                  " USS5      5      USU4$ ©Nrµ  r   rÕ   ©r¸  r+   Úmoveaxis)r.   r'   Úlocr8   s       r/   Ú_parse_args_rvsrÔ  {  s#   € Ü”—’˜Q  AÓ&Ó'¨¨c°4Ð7Ð7r3   c                 óL   • [        [        R                  " USS5      5      USU4$ rÐ  rÑ  )r.   r'   rÓ  rs   s       r/   Ú_parse_args_statsrÖ  ~  s#   € Ü”—’˜Q  AÓ&Ó'¨¨c°7Ð:Ð:r3   c                 óJ   • [        [        R                  " USS5      5      US4$ rÐ  rÑ  )r.   r'   rÓ  s      r/   Ú_parse_argsrØ  �  s!   € Ü”—’˜Q  AÓ&Ó'¨¨cÐ1Ð1r3   c                   ó$   • \ rS rSrS rSS jrSrg)rÊ  i‹  c                 ó   • X l         X0l        UR                  " S0 UR                  5       D6U l        [
        R                  [        [        5      U R                  l        [        R                  [        [        5      U R                  l	        [        R                  [        [        5      U R                  l
        U R                  R                  " U0 UD6u  n  nU R                  R                  " U6 u  U l        U l        g )Nr‡   )r±  rÇ  Ú	__class__Ú_updated_ctor_paramÚdistrÔ  Ú__get__Ú_pb_objÚ_pb_clsrÖ  rØ  rE   rD   r£   )r.   rÝ  r±  rÇ  rÎ  Ú_s         r/   Ú__init__Ú poisson_binomial_frozen.__init__�  s²   € ØŒ	ØŒ	ð —N’NÑ@ T×%=Ñ%=Ó%?Ñ@ˆŒ	ô %4×$;Ñ$;¼GÄWÓ$Mˆ�	‰	Ô!Ü&7×&?Ñ&?ÄÌÓ&Qˆ�	‰	Ô#Ü +× 3Ñ 3´G¼WÓ Eˆ�	‰	Ôà—y‘y×,Ò,¨dÐ;°dÑ;‰ˆ��1ØŸ™×/Ò/°Ð8‰ˆŒ�•r3   Nc                 óº   • U R                   R                  " U R                  0 U R                  D6u  pgnU R                   R                  " XR                  XrX440 UD6$ r5   )rÝ  rØ  r±  rÇ  Úexpect)	r.   ÚfuncÚlbÚubÚconditionalrÇ  rD   rÓ  Úscales	            r/   rå  Úpoisson_binomial_frozen.expectœ  sK   € ØŸ	™	×-Ò-¨t¯y©yÐF¸D¿I¹IÑF‰ˆ�ð �y‰y×Ò §i¡i°¸"ÑRÈTÑRÐRr3   )rD   r±  r£   rÝ  rÇ  )NNNF)r‹   rŒ   r�   rŽ   râ  rå  r�   r‡   r3   r/   rÊ  rÊ  ‹  s   † ò9÷Sr3   rÊ  c                   ó:   • \ rS rSrSrS rS
S jrS rS rS r	S	r
g)Úskellam_geni£  a�  A  Skellam discrete random variable.

%(before_notes)s

Notes
-----
Probability distribution of the difference of two correlated or
uncorrelated Poisson random variables.

Let :math:`k_1` and :math:`k_2` be two Poisson-distributed r.v. with
expected values :math:`\lambda_1` and :math:`\lambda_2`. Then,
:math:`k_1 - k_2` follows a Skellam distribution with parameters
:math:`\mu_1 = \lambda_1 - \rho \sqrt{\lambda_1 \lambda_2}` and
:math:`\mu_2 = \lambda_2 - \rho \sqrt{\lambda_1 \lambda_2}`, where
:math:`\rho` is the correlation coefficient between :math:`k_1` and
:math:`k_2`. If the two Poisson-distributed r.v. are independent then
:math:`\rho = 0`.

Parameters :math:`\mu_1` and :math:`\mu_2` must be strictly positive.

For details see: https://en.wikipedia.org/wiki/Skellam_distribution

`skellam` takes :math:`\mu_1` and :math:`\mu_2` as shape parameters.

%(after_notes)s

%(example)s

c                 óz   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      /$ )Nr†  Fr   r½   r‰  r*   r-   s    r/   r0   Úskellam_gen._shape_infoÁ  s:   € Ü˜5 %¨!¬R¯V©V¨°nÓEÜ˜5 %¨!¬R¯V©V¨°nÓEðGð 	Gr3   Nc                 óL   • UnUR                  X5      UR                  X%5      -
  $ r5   ræ  )r.   r†  r‰  r8   r9   r%   s         r/   r:   Úskellam_gen._rvsÅ  s-   € ØˆØ×$Ñ$ SÓ,Ø×$Ñ$ SÓ,ñ-ð 	.r3   c                 ó.  • [         R                  " SS9   [         R                  " US:  [        R                  " SU-  SSU-
  -  SU-  5      S-  [        R                  " SU-  SSU-   -  SU-  5      S-  5      nS S S 5        U$ ! , (       d  f       W$ = f)Nrø   r  r   rÖ   r   )r+   rû   rG  rR   Ú	_ncx2_pdf©r.   rL   r†  r‰  Úpxs        r/   rU   Úskellam_gen._pmfÊ  s‰   € Ü�[Š[˜hÓ'Ü—’˜!˜a™%ÜŸ-š-¨¨#©¨q°!°A±#©w¸¸#¹Ó>¸qÑ@ÜŸ-š-¨¨#©¨q°!°A±#©w¸¸#¹Ó>¸qÑ@óBˆB÷ (ð
 ˆ	÷ (Ô'ð
 ˆ	ús   •A&BÂ
Bc                 ó2  • [        U5      n[        R                  " SS9   [        R                  " US:  [        R
                  " SU-  SU-  SU-  5      [        R                  " SU-  SUS-   -  SU-  5      5      nS S S 5        U$ ! , (       d  f       W$ = f)Nrø   r  r   rÖ   éþÿÿÿr   )r   r+   rû   rG  r   ÚchndtrrR   Ú_ncx2_sfrô  s        r/   rZ   Úskellam_gen._cdfÒ  sƒ   € Ü�!‹HˆÜ�[Š[˜hÓ'Ü—’˜!˜a™%Ü!Ÿ.š.¨¨3©°°1±°a¸±eÓ<ÜŸ,š, q¨¡u¨a°°1±©g°q¸±uÓ=ó?ˆB÷ (ð ˆ	÷	 (Ô'ð ˆ	ús    ABÂ
Bc                 óF   • X-
  nX-   nU[        US-  5      -  nSU-  nX4XV4$ )NrØ   r   r.  )r.   r†  r‰  r&  ru   rv   rw   s          r/   r}   Úskellam_gen._statsÚ  s6   € Ø‰yˆØ‰iˆØ”D˜# ™“NÑ"ˆØ�‰WˆØ˜"Ð Ð r3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r:   rU   rZ   r}   r�   r‡   r3   r/   rí  rí  £  s!   † ñò:Gô.ò
òõ!r3   rí  Úskellamz	A Skellamc                   óR   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rS rSrg)Úyulesimon_geniå  a¢  A Yule-Simon discrete random variable.

%(before_notes)s

Notes
-----

The probability mass function for the `yulesimon` is:

.. math::

    f(k) =  \alpha B(k, \alpha+1)

for :math:`k=1,2,3,...`, where :math:`\alpha>0`.
Here :math:`B` refers to the `scipy.special.beta` function.

The sampling of random variates is based on pg 553, Section 6.3 of [1]_.
Our notation maps to the referenced logic via :math:`\alpha=a-1`.

For details see the wikipedia entry [2]_.

References
----------
.. [1] Devroye, Luc. "Non-uniform Random Variate Generation",
     (1986) Springer, New York.

.. [2] https://en.wikipedia.org/wiki/Yule-Simon_distribution

%(after_notes)s

%(example)s

c                 ó@   • [        SSS[        R                  4S5      /$ )NÚalphaFr   r½   r*   r-   s    r/   r0   Úyulesimon_gen._shape_info  s   € Ü˜7 E¨A¬r¯v©v¨;¸ÓGÐHÐHr3   Nc           	      ó–   • UR                  U5      nUR                  U5      n[        U* [        [        U* U-  5      * 5      -  5      nU$ r5   )Ústandard_exponentialr   r   r   )r.   r  r8   r9   ÚE1ÚE2Úanss          r/   r:   Úyulesimon_gen._rvs
  sK   € Ø×.Ñ.¨tÓ4ˆØ×.Ñ.¨tÓ4ˆÜ�B�3œ¤ R C¨%¡KÓ 0Ð0Ó1Ñ1Ó2ˆØˆ
r3   c                 ó:   • U[         R                  " XS-   5      -  $ rH   ©r   rÁ   ©r.   rL   r  s      r/   rU   Úyulesimon_gen._pmf  s   € Ø”w—|’| A¨q¡yÓ1Ñ1Ð1r3   c                 ó   • US:„  $ rÅ   r‡   )r.   r  s     r/   r@   Úyulesimon_gen._argcheck  s   € Ø˜‘	Ðr3   c                 óL   • [        U5      [        R                  " XS-   5      -   $ rH   ©r   r   r   r  s      r/   rO   Úyulesimon_gen._logpmf  s   € Ü�5‹zœGŸNšN¨1°a©iÓ8Ñ8Ð8r3   c                 ó@   • SU[         R                  " XS-   5      -  -
  $ rH   r  r  s      r/   rZ   Úyulesimon_gen._cdf  s   € Ø�1”w—|’| A¨q¡yÓ1Ñ1Ñ1Ð1r3   c                 ó:   • U[         R                  " XS-   5      -  $ rH   r  r  s      r/   r_   Úyulesimon_gen._sf  s   € Ø”7—<’< ¨1¡9Ó-Ñ-Ð-r3   c                 óL   • [        U5      [        R                  " XS-   5      -   $ rH   r  r  s      r/   rX  Úyulesimon_gen._logsf  s   € Ü�1‹vœŸš q°!©)Ó4Ñ4Ð4r3   c                 óö  • [         R                  " US:*  [         R                  XS-
  -  5      n[         R                  " US:„  US-  US-
  US-
  S-  -  -  [         R                  5      n[         R                  " US:*  [         R                  U5      n[         R                  " US:„  [	        US-
  5      US-   S-  -  XS-
  -  -  [         R                  5      n[         R                  " US:*  [         R                  U5      n[         R                  " US:„  US-   SUS-  -  SU-  -
  S-
  XS-
  -  US-
  -  -  -   [         R                  5      n[         R                  " US:*  [         R                  U5      nX#XE4$ )	Nr   rÖ   ro   rØ   r8  é   é1   é   )r+   rG  r,   Únanr   )r.   r  rt   r‰  rv   rw   s         r/   r}   Úyulesimon_gen._stats"  sQ  € Ü�XŠX�e˜q‘j¤"§&¡&¨%¸1±9Ñ*=Ó>ˆÜ�hŠh�u˜q‘yØ˜a‘x E¨C¡K°E¸A±IÀ±>Ñ#AÑBÜ—v‘vóˆô �hŠh�u ‘z¤2§6¡6¨3Ó/ˆÜ�XŠX�e˜a‘iÜ˜5 1™9“o¨°©°Q©Ñ6¸%È1Á9Ñ:MÑNÜ—f‘fóˆô �XŠX�e˜q‘j¤"§&¡&¨"Ó-ˆÜ�XŠX�e˜a‘iØ˜a‘i B¨°©¡M°B¸±JÑ$>ÀÑ$CØ$)°Q©YÑ$7¸5À1¹9Ñ$Eñ$Gñ Hä—f‘fóˆô �XŠX�e˜q‘j¤"§&¡&¨"Ó-ˆØ˜ˆÐr3   r‡   rm   )r‹   rŒ   r�   rŽ   r�   r0   r:   rU   r@   rO   rZ   r_   rX  r}   r�   r‡   r3   r/   r   r   å  s6   † ñ òBIôò2òò9ò2ò.ò5õr3   r   Ú	yulesimon)r’   rD   c                   óL   • \ rS rSrSrSrSrS rS rS r	SS jr
S rSS	 jrS
rg)Ú_nchypergeom_geni7  z�A noncentral hypergeometric discrete random variable.

For subclassing by nchypergeom_fisher_gen and nchypergeom_wallenius_gen.

Nc           	      óî   • [        SSS[        R                  4S5      [        SSS[        R                  4S5      [        SSS[        R                  4S5      [        SSS[        R                  4S	5      /$ )
Nrj  Tr   r&   r%   rk  ÚoddsFr½   r*   r-   s    r/   r0   Ú_nchypergeom_gen._shape_infoA  sf   € Ü˜3  q¬"¯&©& k°=ÓAÜ˜3  q¬"¯&©& k°=ÓAÜ˜3  q¬"¯&©& k°=ÓAÜ˜6 5¨1¬b¯f©f¨+°~ÓFðHð 	Hr3   c                 óv   • XUp%nX5-
  n[         R                  " SX&-
  5      n[         R                  " X%5      nXx4$ rÅ   rs  )	r.   rj  r%   rk  r#  rM  rL  Úx_minÚx_maxs	            r/   rE   Ú_nchypergeom_gen._get_supportG  s:   € Ø˜ˆqˆØ‰VˆÜ—
’
˜1˜a™fÓ%ˆÜ—
’
˜1Ó!ˆØˆ|Ðr3   c                 ó,  • [         R                  " U5      [         R                  " U5      p![         R                  " U5      [         R                  " U5      pC[         R                  " U5      ) UR                  [        5      U:H  -  US:¬  -  n[         R                  " U5      ) UR                  [        5      U:H  -  US:¬  -  n[         R                  " U5      ) UR                  [        5      U:H  -  US:¬  -  nUS:„  nX1:*  n	X!:*  n
XV-  U-  U-  U	-  U
-  $ rÅ   )r+   r™  ÚisnanrÚ   r³  )r.   rj  r%   rk  r#  Úcond1Úcond2Úcond3Úcond4Úcond5Úcond6s              r/   r@   Ú_nchypergeom_gen._argcheckN  sâ   € Ü�zŠz˜!‹}œbŸjšj¨›mˆ1Ü—*’*˜Q“-¤§¢¨DÓ!1ˆ4Ü—(’(˜1“+� !§(¡(¬3£-°1Ñ"4Ñ5¸¸a¹Ñ@ˆÜ—(’(˜1“+� !§(¡(¬3£-°1Ñ"4Ñ5¸¸a¹Ñ@ˆÜ—(’(˜1“+� !§(¡(¬3£-°1Ñ"4Ñ5¸¸a¹Ñ@ˆØ�q‘ˆØ‘ˆØ‘ˆØ‰}˜uÑ$ uÑ,¨uÑ4°uÑ<Ð<r3   c           	      ó2   ^ • [         U 4S j5       nU" XX4XVS9$ )Nc                 ó†  >• [         R                  " U 5      [         R                  " U5      -  [         R                  " U5      -  (       a%  [         R                  " U[         R                  5      $ [         R                  " U5      n[        5       n[        UT
R                  5      nU" X!XXe5      n	U	R                  U5      n	U	$ r5   )	r+   r*  Úfullr  Úprodr   ÚgetattrÚrvs_nameÚreshape)rj  r%   rk  r#  r8   r9   ÚlengthÚurnÚrv_genr·  r.   s             €r/   r¸  Ú$_nchypergeom_gen._rvs.<locals>._rvs1[  sƒ   ø€ ä�xŠx˜‹{œRŸXšX a›[Ñ(¬2¯8ª8°A«;×6Ü—w’w˜t¤R§V¡VÓ,Ð,Ü—W’W˜T“]ˆFÜ#Ó%ˆCÜ˜S $§-¡-Ó0ˆFÙ˜˜q¨Ó=ˆCØ—+‘+˜dÓ#ˆCØˆJr3   rœ   rº  )r.   rj  r%   rk  r#  r8   r9   r¸  s   `       r/   r:   Ú_nchypergeom_gen._rvsY  s&   ø€ ä	#ô	ó 
$ð	ñ �Q˜1¨ÑIÐIr3   c                 óÎ   ^ • [         R                  " XX4U5      u  pp4nUR                  S:X  a  [         R                  " U5      $ [         R                  U 4S j5       nU" XX4U5      $ )Nr   c                 ó,  >• [         R                  " U 5      [         R                  " U5      -  [         R                  " U5      -  [         R                  " U5      -  (       a  [         R                  $ TR                  X2XS5      nUR	                  U 5      $ ©Ngê-�™—q=)r+   r*  r  rÝ  Úprobability)rL   rj  r%   rk  r#  r:  r.   s         €r/   Ú_pmf1Ú$_nchypergeom_gen._pmf.<locals>._pmf1n  s_   ø€ ä�xŠx˜‹{œRŸXšX a›[Ñ(¬2¯8ª8°A«;Ñ6¼¿ºÀ!»×DÜ—v‘v�Ø—)‘)˜A !¨5Ó1ˆCØ—?‘? 1Ó%Ð%r3   )r+   rú   r8   Ú
empty_likerS  )r.   rL   rj  r%   rk  r#  rB  s   `      r/   rU   Ú_nchypergeom_gen._pmfh  s_   ø€ ä×.Ò.¨q°Q¸4Ó@Ñˆˆa�DØ�6‰6�Q‹;Ü—=’= Ó#Ð#ä	�‰ô	&ó 
ð	&ñ �Q˜1 Ó&Ð&r3   c                 óx   ^ • [         R                  U 4S j5       nSU;   d  SU;   a	  U" XX45      OSu  pxSu  pšXxXš4$ )Nc                 ó  >• [         R                  " U 5      [         R                  " U5      -  [         R                  " U5      -  (       a   [         R                  [         R                  4$ TR                  X!XS5      nUR	                  5       $ r@  )r+   r*  r  rÝ  rs   )rj  r%   rk  r#  r:  r.   s        €r/   Ú	_moments1Ú*_nchypergeom_gen._stats.<locals>._moments1y  sX   ø€ ä�xŠx˜‹{œRŸXšX a›[Ñ(¬2¯8ª8°A«;×6Ü—v‘vœrŸv™v�~Ð%Ø—)‘)˜A !¨5Ó1ˆCØ—;‘;“=Ð r3   rŒ  Úvrm   )r+   rS  )r.   rj  r%   rk  r#  rs   rH  rŒ  rJ  rn   rM   s   `          r/   r}   Ú_nchypergeom_gen._statsw  sL   ø€ ä	�‰ô	!ó 
ð	!ð .1°G«^¸sÀg»~‘	˜! Ô(Ø!ñ 	ˆà‰ˆØ�QˆzÐr3   r‡   rm   rˆ   )r‹   rŒ   r�   rŽ   r�   r7  rÝ  r0   rE   r@   r:   rU   r}   r�   r‡   r3   r/   r!  r!  7  s3   † ñð €HØ€DòHòò	=ôJò'÷r3   r!  c                   ó    • \ rS rSrSrSr\rSrg)Únchypergeom_fisher_geni†  a›  A Fisher's noncentral hypergeometric discrete random variable.

Fisher's noncentral hypergeometric distribution models drawing objects of
two types from a bin. `M` is the total number of objects, `n` is the
number of Type I objects, and `odds` is the odds ratio: the odds of
selecting a Type I object rather than a Type II object when there is only
one object of each type.
The random variate represents the number of Type I objects drawn if we
take a handful of objects from the bin at once and find out afterwards
that we took `N` objects.

%(before_notes)s

See Also
--------
nchypergeom_wallenius, hypergeom, nhypergeom

Notes
-----
Let mathematical symbols :math:`N`, :math:`n`, and :math:`M` correspond
with parameters `N`, `n`, and `M` (respectively) as defined above.

The probability mass function is defined as

.. math::

    p(x; M, n, N, \omega) =
    \frac{\binom{n}{x}\binom{M - n}{N-x}\omega^x}{P_0},

for
:math:`x \in [x_l, x_u]`,
:math:`M \in {\mathbb N}`,
:math:`n \in [0, M]`,
:math:`N \in [0, M]`,
:math:`\omega > 0`,
where
:math:`x_l = \max(0, N - (M - n))`,
:math:`x_u = \min(N, n)`,

.. math::

    P_0 = \sum_{y=x_l}^{x_u} \binom{n}{y}\binom{M - n}{N-y}\omega^y,

and the binomial coefficients are defined as

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

`nchypergeom_fisher` uses the BiasedUrn package by Agner Fog with
permission for it to be distributed under SciPy's license.

The symbols used to denote the shape parameters (`N`, `n`, and `M`) are not
universally accepted; they are chosen for consistency with `hypergeom`.

Note that Fisher's noncentral hypergeometric distribution is distinct
from Wallenius' noncentral hypergeometric distribution, which models
drawing a pre-determined `N` objects from a bin one by one.
When the odds ratio is unity, however, both distributions reduce to the
ordinary hypergeometric distribution.

%(after_notes)s

References
----------
.. [1] Agner Fog, "Biased Urn Theory".
       https://cran.r-project.org/web/packages/BiasedUrn/vignettes/UrnTheory.pdf

.. [2] "Fisher's noncentral hypergeometric distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Fisher's_noncentral_hypergeometric_distribution

%(example)s

Ú
rvs_fisherr‡   N)	r‹   rŒ   r�   rŽ   r�   r7  r   rÝ  r�   r‡   r3   r/   rM  rM  †  s   † ñGðR €HØ%ƒDr3   rM  Únchypergeom_fisherz$A Fisher's noncentral hypergeometricc                   ó    • \ rS rSrSrSr\rSrg)Únchypergeom_wallenius_geniÙ  a±  A Wallenius' noncentral hypergeometric discrete random variable.

Wallenius' noncentral hypergeometric distribution models drawing objects of
two types from a bin. `M` is the total number of objects, `n` is the
number of Type I objects, and `odds` is the odds ratio: the odds of
selecting a Type I object rather than a Type II object when there is only
one object of each type.
The random variate represents the number of Type I objects drawn if we
draw a pre-determined `N` objects from a bin one by one.

%(before_notes)s

See Also
--------
nchypergeom_fisher, hypergeom, nhypergeom

Notes
-----
Let mathematical symbols :math:`N`, :math:`n`, and :math:`M` correspond
with parameters `N`, `n`, and `M` (respectively) as defined above.

The probability mass function is defined as

.. math::

    p(x; N, n, M) = \binom{n}{x} \binom{M - n}{N-x}
    \int_0^1 \left(1-t^{\omega/D}\right)^x\left(1-t^{1/D}\right)^{N-x} dt

for
:math:`x \in [x_l, x_u]`,
:math:`M \in {\mathbb N}`,
:math:`n \in [0, M]`,
:math:`N \in [0, M]`,
:math:`\omega > 0`,
where
:math:`x_l = \max(0, N - (M - n))`,
:math:`x_u = \min(N, n)`,

.. math::

    D = \omega(n - x) + ((M - n)-(N-x)),

and the binomial coefficients are defined as

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

`nchypergeom_wallenius` uses the BiasedUrn package by Agner Fog with
permission for it to be distributed under SciPy's license.

The symbols used to denote the shape parameters (`N`, `n`, and `M`) are not
universally accepted; they are chosen for consistency with `hypergeom`.

Note that Wallenius' noncentral hypergeometric distribution is distinct
from Fisher's noncentral hypergeometric distribution, which models
take a handful of objects from the bin at once, finding out afterwards
that `N` objects were taken.
When the odds ratio is unity, however, both distributions reduce to the
ordinary hypergeometric distribution.

%(after_notes)s

References
----------
.. [1] Agner Fog, "Biased Urn Theory".
       https://cran.r-project.org/web/packages/BiasedUrn/vignettes/UrnTheory.pdf

.. [2] "Wallenius' noncentral hypergeometric distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Wallenius'_noncentral_hypergeometric_distribution

%(example)s

Úrvs_walleniusr‡   N)	r‹   rŒ   r�   rŽ   r�   r7  r   rÝ  r�   r‡   r3   r/   rQ  rQ  Ù  s   † ñGðR €HØ'ƒDr3   rQ  Únchypergeom_walleniusz&A Wallenius' noncentral hypergeometric)r   N)r   r‰   )r   )iÚ	functoolsr   Úscipyr   Úscipy.specialr   r   r   r   rI   Úscipy.special._ufuncsÚ_ufuncsrR   Úscipy._lib._utilr	   Úscipy._lib.array_api_extraÚ_libÚarray_api_extrar:  Úscipy.interpolater
   Únumpyr   r   r   r   r   r   r   r   r   r   r+   Ú_distn_infrastructurer   r   r   r   r   r   Ú
_biasedurnr   r   r   Ú_stats_pythranr   r!   r‘   r”   r·   r¹   rß   rá   r  r  r=  r?  re  rh  r¢  r¤  rÇ  rÉ  rÞ  rà  rç  r  r  r  r6  r8  rT  rY  r^  rn  r‹  r�  r,   r¨  rª  rÍ  rÔ  rÖ  rØ  rß  rà  rÞ  rÊ  rí  rþ  r   r  r!  rM  rO  rQ  rS  ÚlistÚglobalsÚcopyÚitemsÚpairsÚ_distn_namesÚ_distn_gen_namesÚ__all__r‡   r3   r/   Ú<module>rj     s†  ðõ
 å ß CÓ Cß #Ð #Ý )ß (Ð (Ý &ç M× M× Mã ÷8÷ 8÷,ñ ,õ +ô]*�ô ]*ñ@ 	�wÑ€ô>#�Iô >#ñB ˜A KÑ0€	ôO�Kô Oñd ˜{Ñ+€	ôr
�ô r
ñj 
˜Ñ	"€ôZ�[ô Zñz  Ñ.€
ôN7ˆ{ô N7ñb �!˜&¨=Ñ9€ôX�Kô Xñv ˜{Ñ+€	ô[�[ô [ñ|  Ñ.€
ô=�ô =ñ@ 
�a˜h°Ñ	A€ô?�+ô ?ñD ˜9¨{Ñ
;€ôD0�ô D0ñN 
�a˜hÐ1JÑ	K€ô<�Kô <ñ~ ˜{¨aØ#FñH€	ôt�+ô tñn ˜9ð 0)ñ *€ô
?ˆ{ô ?ñD �!˜&¨8Ñ4€ôi �+ô i ñX ˜ 	°KÑ
@€ôM�;ô Mñ` ˜2Ÿ6™6˜'Ø'Ð2HñJ€ôS<˜ô S<ñl " ÐAUØ),ñ.€ô8ô;ô2ð
 !Ð"3Ð €ˆØ /× 7Ñ 7¸ÀÓ I€Ô Ø"3×";Ñ";¸GÀWÓ"M€Ô Ø'×/Ñ/°¸ÓA€Ô ôSÐ0ô Sô0<!�+ô <!ñ~ ˜Ÿ™˜ i¸+Ñ
F€ôL�Kô Lñ^ ˜{¨aÑ0€	ôL�{ô Lô^K&Ð-ô K&ñ\ ,Ø	Ø3ñ5Ð ô
K(Ð 0ô K(ñ\ 2Ø	 Ø5ñ7Ð ñ 	‰W‹Y�^‰^Ó×#Ñ#Ó%Ó&€Ù!7¸¸{Ó!KÑ €Ðà
Ð)Ñ
)�r3   