## risk.Gpd


The generalized Pareto distribution, as SciPy's


Usage


``` python
risk.Gpd()
```


`genpareto(c=xi, scale=beta)`.

`P(X > x) = (1 + xi x / beta)**(-1 / xi)` for `x >= 0`.


## Parameters


`xi: float`  
Shape; moments of order `1 / xi` and above are infinite.

`beta: float`  
Scale, positive.


## Examples

``` python
>>> from prospicio.risk import Gpd
>>> g = Gpd(0.5, 2.0)
>>> g.mean()
```

4.0

``` python
>>> fit = Gpd.fit([g.quantile((i - 0.5) / 1000) for i in range(1, 1001)])
>>> round(fit.xi, 2), round(fit.beta, 2)
```

(0.5, 2.0)


## Attributes

| Name | Description |
|----|----|
| [beta](#beta) | Scale. |
| [xi](#xi) | Shape. |

------------------------------------------------------------------------


#### beta


Scale.


`beta: float`


------------------------------------------------------------------------


#### xi


Shape.


`xi: float`


## Methods

| Name | Description |
|----|----|
| [cdf()](#cdf) | Distribution function. |
| [fit()](#fit) | Maximum likelihood fit to exceedances (values over a threshold, |
| [mean()](#mean) | Mean, `beta / (1 - xi)`; infinite for `xi >= 1`. |
| [quantile()](#quantile) | Quantile function. |

------------------------------------------------------------------------


#### cdf()


Distribution function.


Usage


``` python
cdf(x)
```


##### Parameters


`x: float`  


##### Returns


`float`  


------------------------------------------------------------------------


#### fit()


Maximum likelihood fit to exceedances (values over a threshold,


Usage


``` python
fit(exceedances)
```


minus the threshold).


##### Parameters


`exceedances: list of float`  
At least 3, non-negative, not all equal.


##### Returns


`Gpd`  


------------------------------------------------------------------------


#### mean()


Mean, `beta / (1 - xi)`; infinite for `xi >= 1`.


Usage


``` python
mean()
```


------------------------------------------------------------------------


#### quantile()


Quantile function.


Usage


``` python
quantile(p)
```


##### Parameters


`p: float`  


##### Returns


`float`
