Skip to main content

risk.iman_conover()

Reorders each component’s draws to a target correlation (Iman-Conover).

Usage

risk.iman_conover(
    pd, correlation, seed, *, dof=None, scores=None, shuffle_rows=False
)

Every component keeps exactly its own draws; only their pairing across simulations changes. The correlation of the result’s normal scores is close to correlation, and Spearman’s rho close to (6 / pi) asin(correlation / 2).

Parameters

pd: PredictiveDistribution
correlation: list of list of float

One row and column per component.

seed: int
dof: float = None

Student t reference scores with these degrees of freedom, which give more joint extremes than the default normal scores (Monograph 15, section 8.2.3; aggregate’s dof).

scores: list of float = None

Reference scores of your own, one per simulation, in any order. Give dof or scores, not both.

shuffle_rows: bool = False
Shuffle the result’s rows. Without it the first component comes back sorted ascending, which matters to anything that reads the rows in order or a slice of them; whole-sample statistics do not notice.

Returns

PredictiveDistribution

Examples

>>> from prospicio.distributions import PredictiveDistribution
>>> from prospicio.risk import iman_conover
>>> rows = [[float(i), float((i * 7919) % 1000)] for i in range(1000)]
>>> pd = PredictiveDistribution(["lob"], [(0,), (1,)], rows)
>>> joined = iman_conover(pd, [[1.0, 0.7], [0.7, 1.0]], seed=3)
>>> sorted(joined.marginal((1,)).draws) == sorted(pd.marginal((1,)).draws)

True