Skip to content

Commit de0024c

Browse files
Documentation sample plot for Rice distribution docs (#3862)
* Added example plot for the Rice distribution. * Updated for scipy rice distribution convention. * Reordering sigmas in rice docstring.
1 parent 5a7680f commit de0024c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pymc3/distributions/continuous.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3884,6 +3884,23 @@ class Rice(PositiveContinuous):
38843884
{\frac {x}{\sigma ^{2}}}\exp
38853885
\left({\frac {-(x^{2}+\nu ^{2})}{2\sigma ^{2}}}\right)I_{0}\left({\frac {x\nu }{\sigma ^{2}}}\right),
38863886
3887+
.. plot::
3888+
3889+
import matplotlib.pyplot as plt
3890+
import numpy as np
3891+
import scipy.stats as st
3892+
plt.style.use('seaborn-darkgrid')
3893+
x = np.linspace(0, 8, 500)
3894+
nus = [0., 0., 4., 4.]
3895+
sigmas = [1., 2., 1., 2.]
3896+
for nu, sigma in zip(nus, sigmas):
3897+
pdf = st.rice.pdf(x, nu / sigma, scale=sigma)
3898+
plt.plot(x, pdf, label=r'$\nu$ = {}, $\sigma$ = {}'.format(nu, sigma))
3899+
plt.xlabel('x', fontsize=12)
3900+
plt.ylabel('f(x)', fontsize=12)
3901+
plt.legend(loc=1)
3902+
plt.show()
3903+
38873904
======== ==============================================================
38883905
Support :math:`x \in (0, \infty)`
38893906
Mean :math:`\sigma {\sqrt {\pi /2}}\,\,L_{{1/2}}(-\nu ^{2}/2\sigma ^{2})`

0 commit comments

Comments
 (0)