## distributions.GeneralizedPareto


Generalized Pareto severity with a location (Riegel's parameterization


Usage


``` python
distributions.GeneralizedPareto()
```


via [GeneralizedPareto.riegel()](distributions.GeneralizedPareto.md#prospicio.distributions.GeneralizedPareto.riegel)): `P(X > x) = (1 + xi (x - location) / beta) ** (-1 / xi)` above the location.

For tail estimation from draws, see [prospicio.risk.Gpd](risk.Gpd.md#prospicio.risk.Gpd); this class is the same distribution as a pricing severity.


## Parameters


`xi: float`  
Shape.

`beta: float`  
Scale; finite and positive.

`location: float = ``0.0`  


## Examples

``` python
>>> from prospicio.distributions import GeneralizedPareto
>>> g = GeneralizedPareto.riegel(1000.0, 2.0, 1.5)
>>> round(g.survival(2000.0), 12) == round((7 / 3) ** -1.5, 12)
```

True


## Attributes

| Name | Description |
|----|----|
| [beta](#beta) | Scale [beta](risk.Gpd.md#prospicio.risk.Gpd.beta). |
| [location](#location) | Location, where the support starts. |
| [xi](#xi) | Shape [xi](risk.Gpd.md#prospicio.risk.Gpd.xi). |

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


#### beta


Scale [beta](risk.Gpd.md#prospicio.risk.Gpd.beta).


`beta: float`


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


#### location


Location, where the support starts.


`location: float`


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


#### xi


Shape [xi](risk.Gpd.md#prospicio.risk.Gpd.xi).


`xi: float`


## Methods

| Name | Description |
|----|----|
| [cdf()](#cdf) | Distribution function `P(X <= x)`. |
| [fit_riegel()](#fit_riegel) | Maximum likelihood fit of Riegel's generalized Pareto with threshold |
| [layer()](#layer) | Expected loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs [attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment). |
| [layer_second_moment()](#layer_second_moment) | Second moment of the loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs |
| [layer_variance()](#layer_variance) | Variance of the loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs [attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment). |
| [lev()](#lev) | Limited expected value `E[min(X, limit)]`. |
| [mean()](#mean) | Mean of the distribution (`inf` if it does not exist). |
| [quantile()](#quantile) | Quantile: the smallest [x](pricing.TabulatedCurve.md#prospicio.pricing.TabulatedCurve.x) with `P(X <= x) >= p`. |
| [riegel()](#riegel) | Riegel's generalized Pareto: local alpha `alpha_ini` at the |
| [sample()](#sample) | [n](distributions.Binomial.md#prospicio.distributions.Binomial.n) draws from stream `stream` of the generator keyed by |
| [std()](#std) | Standard deviation of the distribution. |
| [stop_loss()](#stop_loss) | Expected excess over a retention, `E[max(X - retention, 0)]`. |
| [survival()](#survival) | Survival function `P(X > x)`, accurate far into the tail. |
| [variance()](#variance) | Variance of the distribution (`inf` if it does not exist). |

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


#### cdf()


Distribution function `P(X <= x)`.


Usage


``` python
cdf(x)
```


##### Parameters


`x: float`  


##### Returns


`float`  


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


#### fit_riegel()


Maximum likelihood fit of Riegel's generalized Pareto with threshold


Usage


``` python
fit_riegel(losses, t, reporting_thresholds=None, censored=None, weights=None)
```


[t](distributions.Pareto.md#prospicio.distributions.Pareto.t) to large losses at or above [t](distributions.Pareto.md#prospicio.distributions.Pareto.t).


##### Parameters


`losses: list of float`  

`t: float`  

`reporting_thresholds: list of float = None`  

`censored: list of bool = None`  

`weights: list of float = None`  


##### Returns


`GeneralizedPareto`  
Read the alphas as `t / beta` (initial) and `1 / xi` (tail).


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


#### layer()


Expected loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs [attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment).


Usage


``` python
layer(limit, attachment)
```


##### Parameters


`limit: float`  
`inf` for an unlimited layer.

`attachment: float`  


##### Returns


`float`  


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


#### layer_second_moment()


Second moment of the loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs


Usage


``` python
layer_second_moment(limit, attachment)
```


[attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment).


##### Parameters


`limit: float`  

`attachment: float`  


##### Returns


`float`  


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


#### layer_variance()


Variance of the loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs [attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment).


Usage


``` python
layer_variance(limit, attachment)
```


##### Parameters


`limit: float`  

`attachment: float`  


##### Returns


`float`  


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


#### lev()


Limited expected value `E[min(X, limit)]`.


Usage


``` python
lev(limit)
```


##### Parameters


`limit: float`  


##### Returns


`float`  


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


#### mean()


Mean of the distribution (`inf` if it does not exist).


Usage


``` python
mean()
```


##### Returns


`float`  


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


#### quantile()


Quantile: the smallest [x](pricing.TabulatedCurve.md#prospicio.pricing.TabulatedCurve.x) with `P(X <= x) >= p`.


Usage


``` python
quantile(p)
```


##### Parameters


`p: float`  
Probability in `[0, 1]`.


##### Returns


`float`  


##### Raises


`ValueError`  
If [p](models.Elpd.md#prospicio.models.Elpd.p) is outside `[0, 1]`.


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


#### riegel()


Riegel's generalized Pareto: local alpha `alpha_ini` at the


Usage


``` python
riegel(t, alpha_ini, alpha_tail)
```


threshold [t](distributions.Pareto.md#prospicio.distributions.Pareto.t), tending to `alpha_tail` far out.


##### Parameters


`t: float`  

`alpha_ini: float`  

`alpha_tail: float`  


##### Returns


`GeneralizedPareto`  


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


#### sample()


[n](distributions.Binomial.md#prospicio.distributions.Binomial.n) draws from stream `stream` of the generator keyed by


Usage


``` python
sample(n, seed, stream=0)
```


[seed](aggregate.EventSet.md#prospicio.aggregate.EventSet.seed).


##### Parameters


`n: int`  

`seed: int`  

`stream: int = ``0`  


##### Returns


`list of float`  


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


#### std()


Standard deviation of the distribution.


Usage


``` python
std()
```


##### Returns


`float`  


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


#### stop_loss()


Expected excess over a retention, `E[max(X - retention, 0)]`.


Usage


``` python
stop_loss(retention)
```


##### Parameters


`retention: float`  


##### Returns


`float`  


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


#### survival()


Survival function `P(X > x)`, accurate far into the tail.


Usage


``` python
survival(x)
```


##### Parameters


`x: float`  


##### Returns


`float`  


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


#### variance()


Variance of the distribution (`inf` if it does not exist).


Usage


``` python
variance()
```


##### Returns


`float`
