## risk.allocate()


Allocates a distortion risk measure of the total to the components.


Usage


``` python
risk.allocate(
    pd,
    distortion,
)
```


Euler allocation by co-measure: simulations are ranked by their total and each component gets the distortion-weighted sum of its own draws. The contributions sum to `distortion.measure(pd)`; for `Distortion.tvar(p)` they are the CoTVaRs. Components must add up to the portfolio being allocated.


## Parameters


`pd: PredictiveDistribution`  

`distortion: Distortion`  


## Returns


`list of float`  
One contribution per component, in `pd.components()` order.


## Examples

``` python
>>> from prospicio.distributions import PredictiveDistribution
>>> from prospicio.risk import Distortion, allocate
>>> pd = PredictiveDistribution(["lob"], [("motor",), ("property",)],
...                             [[1.0, 2.0], [4.0, 1.0], [2.0, 5.0], [3.0, 6.0]])
>>> allocate(pd, Distortion.tvar(0.5))
```

\[2.5, 5.5\]
