## risk.covar()


CoVaR of a component: the total's VaR at level `q` over the


Usage


``` python
risk.covar(
    pd,
    key,
    p,
    q,
)
```


simulations where the component is at or above its own VaR at [p](models.Elpd.md#prospicio.models.Elpd.p).

Compare it with the total's unconditional VaR at `q` to see how much one segment's bad years drag the portfolio.


## Parameters


`pd: PredictiveDistribution`  

`key: tuple`  
The component's key.

`p: float`  
The component's distress level.

`q: float`  
The level of the total's VaR.


## Returns


`float`  


## Raises


`ValueError`  
If there is no component `key`.


## Examples

``` python
>>> from prospicio.distributions import PredictiveDistribution
>>> from prospicio.risk import covar
>>> pd = PredictiveDistribution(["lob"], [("a",), ("b",)],
...                             [[1.0, 0.0], [2.0, 1.0], [3.0, 5.0], [4.0, 1.0]])
>>> covar(pd, ("a",), 0.75, 0.5)
```

5.0
