Skip to content

Commit baedcc8

Browse files
committed
fix: documenting equations as per the implementation
1 parent d7fd756 commit baedcc8

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

numpyro/distributions/continuous.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,8 +2724,11 @@ def cdf(self, value: ArrayLike) -> ArrayLike:
27242724
r"""Cumulative distribution function.
27252725
27262726
.. math::
2727-
F(x; \mu, \sigma) = \frac{1}{2}\left[1 + \mathrm{erf}\!\left(
2728-
\frac{x - \mu}{\sigma\sqrt{2}}\right)\right]
2727+
F(x; \mu, \sigma) = \Phi\!\left(\frac{x-\mu}{\sigma}\right)
2728+
2729+
where, :math:`\Phi` is the
2730+
`cumulative distribution function of standard normal distribution <https://en.wikipedia.org/wiki/Normal_distribution#Cumulative_distribution_function>`_.
2731+
Implementation uses :func:`jax.scipy.special.ndtr` for :math:`\Phi`.
27292732
27302733
:param value: Value to evaluate.
27312734
:type value: ArrayLike
@@ -2734,13 +2737,8 @@ def cdf(self, value: ArrayLike) -> ArrayLike:
27342737
return ndtr(scaled)
27352738

27362739
def log_cdf(self, value: ArrayLike) -> ArrayLike:
2737-
r"""Log of the cumulative distribution function.
2738-
2739-
.. math::
2740-
\log F(x; \mu, \sigma) = \log\!\left(\frac{1}{2}\left[1 + \mathrm{erf}\!\left(
2741-
\frac{x - \mu}{\sigma\sqrt{2}}\right)\right]\right)
2742-
2743-
Implementation uses :func:`jax.scipy.stats.norm.logcdf`.
2740+
r"""Log of the cumulative distribution function. Implementation
2741+
calls :func:`jax.scipy.stats.norm.logcdf`.
27442742
27452743
:param value: Value to evaluate.
27462744
:type value: ArrayLike
@@ -2753,6 +2751,10 @@ def icdf(self, q: ArrayLike) -> ArrayLike:
27532751
.. math::
27542752
F^{-1}(q; \mu, \sigma) = \mu + \sigma\,\Phi^{-1}(q)
27552753
2754+
where, :math:`\mathrm{\Phi^{-1}}` is inverse
2755+
`cumulative distribution function of standard normal distribution <https://en.wikipedia.org/wiki/Normal_distribution#Cumulative_distribution_function>`_.
2756+
Implementation uses :func:`jax.scipy.special.ndtri` for :math:`\Phi^{-1}`.
2757+
27562758
:param q: Probability value in :math:`[0,1]`.
27572759
:type q: ArrayLike
27582760
"""

0 commit comments

Comments
 (0)