freealg.distributions.CompoundFreePoisson#

class freealg.distributions.CompoundFreePoisson(t, w, lam)#

Compound free Poisson distribution

Parameters:
tarray_like

Array \([t_1, \dots, t_r]\), where \(t_i\) is the jump location \(\delta_{t_i}\) in the discrete distribution \(H\) (see notes below).

warray_like

Array \([w_1, \dots, w_r]\), where \(w_i\) is the jump weights of \(\delta_{t_i}\) in the discrete distribution \(H\) (see notes below). The sum of all weights must be one: \(\sum_{i=1}^r w_i = 1\).

lamfloat

Total rate (intensity) \(\lambda > 0\).

Notes

The compound free Poisson law with the rate \(\lambda\) and jump \(H\), given by the R transform

\[R_{\mathrm{CFP}(\lambda, H)} = \lambda \int_{\mathbb{R}} \frac{x}{1 - wx} H(\mathrm{d} x).\]

Here, \(H > 0\) is a positive measure. We assume \(H\) is discrete atomic distribution given by

\[H = \sum_{i=1}^r w_i \delta_{t_i},\]

where \(t_i>0\) are jump sizes (given by the parameter t as a list), and \(w_i>0\) are weights with \(\sum_i w_i = 1\) (given by the parameter w as a list). In this case, the R transform becomes:

\[R(w) = \lambda \sum_{i=1}^r w_i \frac{t_i}{1-t_i w}.\]

Stieltjes Transform:

The Stieltjes transform \(m(z)\) satisfies

\[R(-m(z)) = z + \frac{1}{m(z)}.\]

Solving for \(m\) and clearing the common denominators for the rational function representation, we get a polynomial \(P(z, m) = 0\) with

\[P(z, m) = \sum_{i=1}^{d_z} \sum_{j=1}^{d_m} c_{ij} z^i m^j = 0,\]

where \(d_z\) and \(d_m\) are the degrees of \(P\) in \(z\) and \(m\), respectively. The degree \(d_z\) is always 1.

For \(r\) atoms in \(H\), this yields a polynomial with degree \(d_m = r+1\) in \(m\).

This model has an atom at \(x = a\) with mass \(\max(1-\lambda, 0)\).

Functions:

  • The coefficients \(c_{ij}\) can be obtained from poly() function.

  • For a given \(z\), all \(d_m\) roots (in \(m\)) of the polynomial \(P(z, m) = 0\) can be computed by roots().

  • Among all roots, only one root corresponds to the physical branch, known as the Stieltjes transform. This physical root can be computed by stieltjes() function.

Examples

We create a compound free Poisson distribution, plot is density and compute its support.

>>> from freealg.distributions import CompoundFreePoisson

>>> # Create an object of the class
>>> cfp = CompoundFreePoisson(t=[2.0, 5.5], w=[0.75, 1-0.75], lam=0.1)

>>> # Plot density
>>> rho = cfp.density(plot=True)

>>> # Get the support intervals
>>> supp = cfp.support()
[(0.9984996249062267, 3.13165791447862),
 (4.157389347336835, 7.597674418604652)]

We can also sample from this distribution: either as a matrix realization, or as an array of eigenvalues:

>>> # Generate a random matrix realization of this law
>>> A = cfp.matrix(size=2000, seed=0)

>>> # Sample from eigenvalues of this law
>>> eig = cfp.sample(size=2000)

Here, we compute the coefficients of the polynomial \(P(z, m) = 0\), all its roots at a given point \(z\), and its physical root (Stieltjes transform):

>>> # Get the coefficients of the polynomial P(z, m) = 0
>>> coeffs = cfp.poly().real
[[ 1.      7.2125  9.9    -0.    ]
 [ 0.      1.      7.5    11.    ]]

>>> # Compute all roots of the polynomial at a given z
>>> z = 2.0 + 3.0j
>>> roots = cfp.roots(z)
array([-0.49936889-0.02424734j, -0.13510408+0.23535224j,
       -0.18580675-0.0034126j ])

>>> # Compute the Stieltjes transform at z (the physical root)
>>> m = cfp.stieltjes(z)
array(-0.13510408+0.23535224j)

Methods

density([x, eta, max_iter, tol, ...])

Density of distribution.

roots(z)

Roots of polynomial implicitly representing Stieltjes transform

stieltjes(z[, max_iter, tol])

Stieltjes transform of distribution.

support([eta, n_probe, thr, x_max])

Support intervals of distribution.

sample(size[, x_min, x_max, method, seed, ...])

Sample from distribution.

matrix(size[, seed])

Generate matrix with the spectral density of the distribution.

poly()

Polynomial coefficients implicitly representing the Stieltjes

plot_branches([x, y, latex, save])

Plot branches of the spectral curve of Stieltjes transform.