pricing.Portfolio
A portfolio as the distribution of its total and each unit’s
Usage
pricing.Portfolio()conditional expectation given the total, kappa_i(x) = E[X_i | X = x]: the representation of Mildenhall and Major (Pricing Insurance Risk, 2022) and CAS Monograph 15, for pricing with limited liability and the natural allocation.
Parameters
units: list of strrows: list of list of float-
Each scenario’s loss by unit; non-negative.
probs: list of float- The scenarios’ probabilities; equal when omitted.
Examples
>>> from prospicio.pricing import Portfolio
>>> from prospicio.risk import Distortion
>>> rows = [[15, 7, 0], [15, 13, 0], [5, 20, 11], [7, 33, 0], [13, 20, 7],
... [5, 27, 8], [15, 16, 9], [26, 19, 10], [17, 8, 40], [16, 20, 64]]
>>> insco = Portfolio(["A", "B", "C"], rows)
>>> price = insco.price(Distortion.ccoc(0.15), assets=100)
>>> round(price.total.premium, 6)53.565217
>>> [round(u.assets, 6) for u in price.allocated][16.0, 20.0, 64.0]
Attributes
| Name | Description |
|---|---|
| probs | The probability of each total. |
| totals | The distinct totals, ascending. |
| units | Unit names. |
probs
The probability of each total.
probs: list[float]
totals
The distinct totals, ascending.
totals: list[float]
units
Unit names.
units: list[str]
Methods
| Name | Description |
|---|---|
| allocation_set() | The range of each unit’s premium over the natural allocation set: |
| assets() | Assets at the capital standard p: the lower p quantile of |
| assets_for_epd() | The smallest assets whose total EPD ratio is at most epd. |
| bodoff() | Bodoff’s percentile layer of capital: each unit’s share of the |
| bodoff_price() | Bodoff’s percentile layer of capital priced by a distortion: each |
| calibrate() | The member of a distortion family that prices the loss capped at |
| comonotonic_kappa() | Each unit’s comonotonic allocation at each total, a non-decreasing |
| epd() | The expected policyholder deficit ratio with these assets: in |
| expected() | Each unit’s expected loss. |
| from_independent() | From independent units, each a Grid with the same step; the total |
| from_predictive() | From a joint simulation: each component is a unit, each simulation |
| kappa() | A unit’s conditional expectation at each total. |
| premium_bounds() | The range of each unit’s premium over every distortion that prices |
| price() | The premium of the loss capped at the assets, and its natural |
| price_stand_alone() | Each unit priced as if it were the whole book, at its own lower |
| priority() | The priority ladder: each unit’s recovery from the assets when it |
| priority_kappa() |
Where in the total the shortfall (X - a)+ falls when unit is
|
| tvar_threshold() | The level t at which the total’s TVaR reaches its VaR at p, |
allocation_set()
The range of each unit’s premium over the natural allocation set:
Usage
allocation_set(distortion, assets=None, p=None)every order of the outcomes whose totals, capped at the assets, tie. The linear and lifted allocations lie in it. Needs a portfolio built from rows.
Parameters
distortion: Distortionassets: float = Nonep: float = None
Returns
Examples
Pricing Insurance Risk’s Example 259, where the total 10 is 9 + 1 or 10 + 0:
>>> from prospicio.pricing import Portfolio
>>> from prospicio.risk import Distortion
>>> rows = [[a, b] for a in (0, 9, 10) for b in (0, 1, 90)]
>>> probs = [p * q for p in (0.5, 0.25, 0.25) for q in (0.5, 0.25, 0.25)]
>>> port = Portfolio(["X1", "X2"], rows, probs)
>>> x1 = port.allocation_set(Distortion.proportional_hazard(0.5), assets=100)[0]
>>> round(x1["lower"], 4), round(x1["upper"], 4)(6.2009, 6.2085)
assets()
Usage
assets(p)the total.
Parameters
p: float
Returns
float
assets_for_epd()
The smallest assets whose total EPD ratio is at most epd.
Usage
assets_for_epd(epd)Parameters
epd: float
Returns
float
bodoff()
Bodoff’s percentile layer of capital: each unit’s share of the
Usage
bodoff(assets=None, p=None)assets.
Parameters
assets: float = Nonep: float = None
Returns
list of float
bodoff_price()
Bodoff’s percentile layer of capital priced by a distortion: each
Usage
bodoff_price(distortion, assets=None, p=None)layer of assets, its cost g(S) and its capital 1 - g(S) are shared in Bodoff’s proportions, so every layer earns its own return. The assets are bodoff’s, the losses the equal-priority recoveries, and the premiums add up to the price of the capped total.
Parameters
distortion: Distortionassets: float = Nonep: float = None
Returns
NaturalPrice
Examples
Bodoff’s Thought Experiment 1 at a 10% return (Pricing Insurance Risk, Table 15.24):
>>> from prospicio.pricing import Portfolio
>>> from prospicio.risk import Distortion
>>> port = Portfolio(["Hu", "EQ"], [[0, 0], [99, 0], [0, 100], [99, 100]],
... [0.76, 0.19, 0.04, 0.01])
>>> plc = port.bodoff_price(Distortion.ccoc(0.1), assets=100)
>>> [round(u.premium, 4) for u in plc.allocated][24.8729, 5.8635]
calibrate()
The member of a distortion family that prices the loss capped at
Usage
calibrate(
family,
assets=None,
p=None,
*,
premium=None,
return_on_capital=None,
loss_ratio=None,
r0=0.0
)the assets at a target: give exactly one of premium, return_on_capital and loss_ratio.
Parameters
family: str-
As for prospicio.risk.calibrate.
assets: float = Nonep: float = Nonepremium: float = Nonereturn_on_capital: float = Noneloss_ratio: float = Noner0: float = 0.0
Returns
Distortion
comonotonic_kappa()
Each unit’s comonotonic allocation at each total, a non-decreasing
Usage
comonotonic_kappa()function of the total that still adds up to it: Denuit et al.’s (2025) improvement of kappa, aggregate’s make_comonotonic_allocations.
Returns
dict of str to list of float- Unit name to its allocation at each of totals().
epd()
The expected policyholder deficit ratio with these assets: in
Usage
epd(assets)total, and by unit under equal priority.
Parameters
assets: float
Returns
tuple of (float, list of float)
expected()
Each unit’s expected loss.
Usage
expected()Returns
list of float
from_independent()
From independent units, each a Grid with the same step; the total
Usage
from_independent(units, grids)and the conditional expectations are computed by FFT.
Parameters
units: list of strgrids: list of Grid
Returns
Portfolio
from_predictive()
From a joint simulation: each component is a unit, each simulation
Usage
from_predictive(pd)an equally likely scenario.
Parameters
pd: PredictiveDistribution
Returns
Portfolio
kappa()
A unit’s conditional expectation at each total.
Usage
kappa(unit)Parameters
unit: str
Returns
list of float
price()
The premium of the loss capped at the assets, and its natural
Usage
price(
distortion,
assets=None,
p=None,
allocation="linear",
*,
bottom_layer="limit",
atom="separate"
)allocation to the units.
Parameters
distortion: Distortionassets: float = None-
The asset level; or give p. The largest total by default.
p: float = None-
The capital standard: assets at the total’s lower p quantile.
allocation: (linear, lifted) = "linear"-
The unit share of the assets above the asset level: expected (linear) or distorted (lifted).
bottom_layer: (limit, none) = "limit"-
Capital in the layer below the smallest total, where the return is undefined: at its limit from above, or none (Monograph 15’s equation 8.5 as printed).
atom: (separate, lumped) = "separate"- For the linear allocation, a total exactly at the assets keeps its own weight, or is lumped with the default outcomes (Pricing Insurance Risk’s linear allocation).
Returns
NaturalPrice
Notes
The defaults follow aggregate (1.0.1 and 1.2.0 alike). A total exactly at the assets keeps its own weight in the linear allocation, where Pricing Insurance Risk lumps it with the default outcomes (its Example 235: 4.3 against 4.16 here); atom="lumped" gives the book’s numbers, and p always lands on a total. In the bottom layer of capital, below the smallest total, the units’ margins (which sum to zero) take capital at g'(1) / (1 - g'(1)): 1/r for CCoC, rho / (1 - rho) for the proportional hazard, 0 for Wang, dual power and TVaR. Monograph 15’s equation 8.5 gives that layer none (bottom_layer="none"), so CCoC and PH capital by unit differ from it; the total and the premiums do not.
Examples
>>> from prospicio.pricing import Portfolio
>>> from prospicio.risk import Distortion
>>> x1 = [1, 2, 3, 4, 5, 6, 7, 8, 12, 10]
>>> x2 = [1, 2, 3, 4, 5, 9, 8, 12, 13, 20]
>>> port = Portfolio(["X1", "X2"], [[float(a), float(b)] for a, b in zip(x1, x2)])
>>> book = port.price(Distortion.tvar(0.8), assets=10, atom="lumped")
>>> [round(u.premium, 6) for u in book.allocated][4.3, 5.7]
price_stand_alone()
Each unit priced as if it were the whole book, at its own lower
Usage
price_stand_alone(distortion, p)p quantile, against the book priced together at the VaR of its total, aggregate’s Portfolio.price_stand_alone. The excess of sum over total is the diversification benefit.
Parameters
distortion: Distortionp: float-
The VaR capital standard, in
(0, 1).
Returns
StandAlone
Raises
ValueError-
If p is outside
(0, 1).
Examples
>>> from prospicio.pricing import Portfolio
>>> from prospicio.risk import Distortion
>>> port = Portfolio(["a", "b"], [[0, 0], [1, 4], [4, 1], [5, 5]])
>>> s = port.price_stand_alone(Distortion.proportional_hazard(0.5), 0.75)
>>> [u.assets for u in s.stand_alone], s.total.assets([4.0, 4.0], 5.0)
priority()
The priority ladder: each unit’s recovery from the assets when it
Usage
priority(assets=None, p=None)ranks ahead of the other units pooled (senior), pro rata (equal), or behind them (junior), as aggregate’s priority_epd_df. Each is unit against the rest pooled, so on three or more units only the equal recoveries add up to the total. Exact under any dependence for a portfolio built from scenarios.
Parameters
assets: float = None-
The largest total by default.
p: float = None- The capital standard: assets at the total’s lower p quantile.
Returns
Examples
>>> from prospicio.pricing import Portfolio
>>> port = Portfolio(["A", "B"], [[15, 7], [5, 20], [26, 19], [17, 48]])
>>> ladder = port.priority(assets=50)
>>> round(ladder["senior"][0] + ladder["junior"][1], 9) == ladder["senior"][2]True
priority_kappa()
Where in the total the shortfall (X - a)+ falls when unit is
Usage
priority_kappa(unit, assets=None, p=None)junior to the rest pooled: at each of totals, the junior unit’s expected part E[min((X - a)+, X_i) | X = x] and the senior pool’s, which add up to (x - a)+. As aggregate’s priority_kappa.
Parameters
unit: strassets: float = Nonep: float = None
Returns
tuple of (list of float, list of float)- The junior and the senior parts.
tvar_threshold()
Usage
tvar_threshold(p)aggregate’s Portfolio.tvar_threshold(p, 'lower').
Parameters
p: float
Returns
float
Raises
ValueError-
If p is outside
[0, 1].