Skip to main content

aggregate.JointGrid

A joint distribution of two losses on a grid, ``P(A = i * step_a, B = j

Usage

aggregate.JointGrid()
  • step_b)``: rows are line A and columns line B. The mass past the last row or column is carried on it.

Parameters

steps: tuple of (float, float)
probs: list of list of float
One row per point of A, one column per point of B, summing to 1.

Attributes

Name Description
probs The probabilities, one list per row.
shape The number of rows (line A) and columns (line B).
steps The step on each axis.

probs

The probabilities, one list per row.

probs: list[list[float]]


shape

The number of rows (line A) and columns (line B).

shape: tuple[int, int]


steps

The step on each axis.

steps: tuple[float, float]

Methods

Name Description
correlation() Pearson’s correlation of A and B; NaN if either is constant.
covariance() Cov(A, B).
from_copula() The joint per-event severity of two losses coupled by a copula.
independent() The joint law of two independent losses.
marginal() The marginal distribution of line A (axis=0) or B (axis=1).
mean() The mean of line A (axis=0) or B (axis=1).
moment() The raw mixed moment E[A^p B^q].
prob() P(A = i * step_a, B = j * step_b).
total() The distribution of the total A + B: exact when the steps are
variance() The variance of line A (axis=0) or B (axis=1).

correlation()

Pearson’s correlation of A and B; NaN if either is constant.

Usage

correlation()

covariance()

Cov(A, B).

Usage

covariance()

from_copula()

The joint per-event severity of two losses coupled by a copula.

Usage

from_copula(a, b, copula, *, trigger_a=1.0, trigger_b=1.0)

Each line is hit with its trigger probability and then loses from its grid (a for line A, the rows; b for B), so mass at 0 is an event that misses the line; the two per-event marginals are joined by the copula’s rectangle probabilities over their cdfs, as aggregate’s copula bivariate. The marginals come back exactly. Give the result to fft_bivariate.

Parameters
a: Grid

The loss to each line given that the event hits it.

b: Grid

The loss to each line given that the event hits it.

copula: GaussianCopula or ArchimedeanCopula

Two-dimensional, with a distribution function.

trigger_a: float = 1.0

The probability that an event hits each line.

trigger_b: float = 1.0
The probability that an event hits each line.
Returns
JointGrid
Examples
>>> from prospicio.aggregate import JointGrid
>>> from prospicio.distributions import Grid
>>> from prospicio.risk import ArchimedeanCopula
>>> a = Grid(1.0, [0.25, 0.5, 0.25])
>>> b = Grid(1.0, [0.5, 0.5])
>>> s = JointGrid.from_copula(a, b, ArchimedeanCopula("gumbel", 2.0, 2), trigger_a=0.5)
>>> s.correlation() > 0

True


independent()

The joint law of two independent losses.

Usage

independent(a, b)
Parameters
a: Grid
b: Grid
Returns
JointGrid

marginal()

The marginal distribution of line A (axis=0) or B (axis=1).

Usage

marginal(axis)
Parameters
axis: int
Returns
Grid

mean()

The mean of line A (axis=0) or B (axis=1).

Usage

mean(axis)

moment()

The raw mixed moment E[A^p B^q].

Usage

moment(p, q)
Parameters
p: int
q: int
Returns
float

prob()

P(A = i * step_a, B = j * step_b).

Usage

prob(i, j)
Parameters
i: int
j: int
Returns
float

total()

The distribution of the total A + B: exact when the steps are

Usage

total()

equal, otherwise on the larger step with each cell’s mass split to keep the mean.

Returns
Grid

variance()

The variance of line A (axis=0) or B (axis=1).

Usage

variance(axis)