File: continuous_norminvgauss.rst

package info (click to toggle)
scipy 1.16.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 236,092 kB
  • sloc: cpp: 503,720; python: 345,302; ansic: 195,677; javascript: 89,566; fortran: 56,210; cs: 3,081; f90: 1,150; sh: 857; makefile: 792; pascal: 284; csh: 135; lisp: 134; xml: 56; perl: 51
file content (33 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

.. _continuous-norminvgauss:

Normal Inverse Gaussian Distribution
==============================================

The probability density function is given by:

.. math::
	:nowrap:

	\begin{eqnarray*}
	        f(x; a, b) = \frac{a \exp\left(\sqrt{a^2 - b^2} + b x \right)}{\pi \sqrt{1 + x^2}} \, K_1\left(a * \sqrt{1 + x^2}\right),
	\end{eqnarray*}

where :math:`x` is a real number, the parameter :math:`a` is the tail heaviness and :math:`b` is the asymmetry parameter satisfying :math:`a > 0` and :math:`|b| \leq a`. :math:`K_1` is the modified Bessel function of second kind (`scipy.special.k1`).

A normal inverse Gaussian random variable with parameters :math:`a` and :math:`b` can be expressed  as :math:`X = b V + \sqrt(V) X` where :math:`X` is ``norm(0,1)`` and :math:`V` is ``invgauss(mu=1/sqrt(a**2 - b**2))``. Hence, the normal inverse Gaussian distribution is a special case of normal variance-mean mixtures.

Another common parametrization of the distribution is given by the following expression of the pdf:

.. math::
	:nowrap:

	\begin{eqnarray*}
        g(x, \alpha, \beta, \delta, \mu) = \frac{\alpha\delta K_1 \left(\alpha\sqrt{\delta^2 + (x - \mu)^2}\right)}{\pi \sqrt{\delta^2 + (x - \mu)^2}} \,
        e^{\delta \sqrt{\alpha^2 - \beta^2} + \beta (x - \mu)}
	\end{eqnarray*}

In SciPy, this corresponds to :math:`a = \alpha \delta, b = \beta  \delta, \text{loc} = \mu, \text{scale}=\delta`.


Implementation: `scipy.stats.norminvgauss`