## risk.threshold_diagnostics()


Threshold diagnostics for peaks over threshold: at each threshold the


Usage


``` python
risk.threshold_diagnostics(
    draws,
    thresholds,
)
```


mean excess and the generalized Pareto fitted to the exceedances, with standard errors (the numbers behind `ismev`'s `mrl.plot` and `gpd.fitrange`).

Above a threshold where a GPD fits, the mean excess is linear in the threshold and the shape [xi](risk.Gpd.md#prospicio.risk.Gpd.xi) and modified scale `beta - xi * u` are constant up to their sampling error: pick the lowest threshold above which they are stable, then fit a [PotTail](risk.PotTail.md#prospicio.risk.PotTail) there. Standard errors come from the observed information and hold for `xi > -0.5`. A threshold with too few values above it gives NaN where it cannot estimate (2 for the mean excess's standard error, 3 for the GPD).


## Parameters


`draws: list of float`  

`thresholds: list of float`  


## Returns


`dict of str to list`  
Columns [threshold](risk.PotTail.md#prospicio.risk.PotTail.threshold), `n_above`, [mean_excess](risk.mean_excess.md#prospicio.risk.mean_excess), `mean_excess_se`, [xi](risk.Gpd.md#prospicio.risk.Gpd.xi), `xi_se`, [beta](risk.Gpd.md#prospicio.risk.Gpd.beta), `modified_scale` and `modified_scale_se`, one entry per threshold (`pandas.DataFrame` takes it as is).


## Examples

``` python
>>> from prospicio.risk import threshold_diagnostics
>>> d = threshold_diagnostics([1.0, 2.0, 3.0, 4.0, 5.0], [2.5])
>>> d["n_above"], d["mean_excess"]
```

(\[3\], \[1.5\])
