## risk.haircut()


The haircut allocation of an exogenous [total](risk.Allocation.md#prospicio.risk.Allocation.total) (a premium, a capital


Usage


``` python
risk.haircut(
    pd,
    total,
    measure,
    level,
)
```


amount): each component's stand-alone [measure](risk.Distortion.md#prospicio.risk.Distortion.measure) at [level](reserving.ApcGlmFit.md#prospicio.reserving.ApcGlmFit.level), scaled to add up to [total](risk.Allocation.md#prospicio.risk.Allocation.total) (*Pricing Insurance Risk*, section 12.2.3).


## Parameters


`pd: PredictiveDistribution`  
Components that add up to the portfolio.

`total: float`  

`measure: str`  
`"var"`, `"tvar"` ([level](reserving.ApcGlmFit.md#prospicio.reserving.ApcGlmFit.level) a probability) or `"epd"` ([level](reserving.ApcGlmFit.md#prospicio.reserving.ApcGlmFit.level) the EPD ratio [r](distributions.NegativeBinomial.md#prospicio.distributions.NegativeBinomial.r): the assets at which `E[(X - a)+] = r E[X]`).

`level: float`  


## Returns


`LevelAllocation`  


## Raises


`ValueError`  
For a level out of range, a mean that is not positive (EPD) or stand-alone measures summing to 0.


## Examples

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

\[7.0, 11.0\]
