## aggregate.EventLossTable


A catastrophe model's event loss table with secondary uncertainty.


Usage


``` python
aggregate.EventLossTable()
```


Each row is an event with an annual rate, a mean loss, independent and correlated standard deviations, and an exposure, the most it can lose. Events occur as independent Poisson processes; an event's loss, given that it occurs, is a beta distribution on `[0, exposure]` with the row's mean and standard deviation `sd_independent + sd_correlated` (summed, as catastrophe models report them for one portfolio), or the mean exactly when that is 0. A row whose standard deviation no beta on its exposure can have is an error naming the row.


## Parameters


`rate: list of float`  
One value per event, as the table's columns.

`mean: list of float`  
One value per event, as the table's columns.

`sd_independent: list of float`  
One value per event, as the table's columns.

`sd_correlated: list of float`  
One value per event, as the table's columns.

`exposure: list of float`  
One value per event, as the table's columns.


## Examples

``` python
>>> from prospicio.aggregate import EventLossTable
>>> elt = EventLossTable([0.01, 0.05], [800.0, 200.0], [200.0, 0.0], [100.0, 0.0], [2000.0, 500.0])
>>> round(elt.rate, 12), round(elt.expected_annual_loss, 12)
```

(0.06, 18.0)

``` python
>>> events, ids = elt.simulate(1000, seed=1)
>>> events.n_sims
```

1000


## Attributes

| Name | Description |
|----|----|
| [expected_annual_loss](#expected_annual_loss) | The expected annual loss, the sum of rate times mean. |
| [rate](#rate) | The mean number of events a year, the rates' sum. |

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


#### expected_annual_loss


The expected annual loss, the sum of rate times mean.


`expected_annual_loss: float`


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


#### rate


The mean number of events a year, the rates' sum.


`rate: float`


## Methods

| Name | Description |
|----|----|
| [aggregate_grid()](#aggregate_grid) | The annual total loss on the grid `0, step, ..., (points - 1) *</td> </tr> <tr> <td>[count()](#count)</td> <td>The year's number of events, a Poisson count with mean`rate`.</td> </tr> <tr> <td>[exceedance_frequency()](#exceedance_frequency)</td> <td>The annual frequency of events losing more than`x`.</td> </tr> <tr> <td>[occurrence_pml()](#occurrence_pml)</td> <td>The occurrence PML at annual probability`p`: the loss whose</td> </tr> <tr> <td>[oep()](#oep)</td> <td>The occurrence exceedance probability at`x`,</td> </tr> <tr> <td>[severity_grid()](#severity_grid)</td> <td>One event's loss on the grid`0, step, …, (points - 1) \* step\`\`, |
| [severity_moments()](#severity_moments) | The first three raw moments of one event's loss given that it |
| [simulate()](#simulate) | Simulated years of events, with each loss's event (row index). |

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


#### aggregate_grid()


The annual total loss on the grid \`\`0, step, …, (points - 1) \*


Usage


``` python
aggregate_grid(step, points, bucketing="nearest")
```


step`:`count()`compounded with`severity_grid`by`fft\`\`.


##### Parameters


`step: float`  

`points: int`  

`bucketing: (nearest, means_linear) = ``"nearest"`  


##### Returns


`tuple of (Grid, CompoundReport, dict)`  
The annual total, the compound report and the severity's report.


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


#### count()


The year's number of events, a Poisson count with mean [rate](pricing.CasualtyProfile.md#prospicio.pricing.CasualtyProfile.rate).


Usage


``` python
count()
```


##### Returns


`Poisson`  


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


#### exceedance_frequency()


The annual frequency of events losing more than [x](distributions.Ogive.md#prospicio.distributions.Ogive.x).


Usage


``` python
exceedance_frequency(x)
```


##### Parameters


`x: float`  


##### Returns


`float`  


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


#### occurrence_pml()


The occurrence PML at annual probability [p](models.Elpd.md#prospicio.models.Elpd.p): the loss whose


Usage


``` python
occurrence_pml(p)
```


occurrence exceedance probability is [p](models.Elpd.md#prospicio.models.Elpd.p).


##### Parameters


`p: float`  


##### Returns


`float`  


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


#### oep()


The occurrence exceedance probability at [x](distributions.Ogive.md#prospicio.distributions.Ogive.x),


Usage


``` python
oep(x)
```


`1 - exp(-exceedance_frequency(x))`.


##### Parameters


`x: float`  


##### Returns


`float`  


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


#### severity_grid()


One event's loss on the grid `0, step, ..., (points - 1) * step`,


Usage


``` python
severity_grid(step, points, bucketing="nearest")
```


the severity of the table's compound Poisson model for [fft](aggregate.fft.md#prospicio.aggregate.fft) and [Tower.on_grid](reinsurance.Tower.md#prospicio.reinsurance.Tower.on_grid) with [count()](models.TwoPartFit.md#prospicio.models.TwoPartFit.count).

`bucketing="nearest"` is [aggregate](aggregate.Clash.md#prospicio.aggregate.Clash.aggregate)'s rule for a table with secondary uncertainty: each row's loss law bucketed by the nearest node, an atom exactly on a bucket edge split evenly, and the mass above the top bucket's edge on the top node. `"means_linear"` is its rule for a table of means alone: the secondary uncertainty is dropped and each mean split between its two neighbouring nodes so that the mean is kept.


##### Parameters


`step: float`  

`points: int`  

`bucketing: (nearest, means_linear) = ``"nearest"`  


##### Returns


`tuple of (Grid, dict)`  
The severity and a report: `bucketing`, `rate_above` (the annual rate of events above the grid, moved onto its top node), [severity_mean](aggregate.Ruin.md#prospicio.aggregate.Ruin.severity_mean) and [grid_mean](aggregate.CompoundReport.md#prospicio.aggregate.CompoundReport.grid_mean).


##### Examples

``` python
>>> from prospicio.aggregate import EventLossTable, fft
>>> elt = EventLossTable([0.5, 0.25], [100.0, 300.0], [0.0, 0.0], [0.0, 0.0], [400.0, 400.0])
>>> sev, report = elt.severity_grid(100.0, 64)
>>> [round(p, 12) for p in sev.probs[:4]]
```

\[0.0, 0.666666666667, 0.0, 0.333333333333\]

``` python
>>> annual, _ = fft(elt.count(), sev, 64)
>>> round(annual.mean(), 9)
```

125.0

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


#### severity_moments()


The first three raw moments of one event's loss given that it


Usage


``` python
severity_moments()
```


occurs, `[E X, E X**2, E X**3]`; the annual cumulants are [rate](pricing.CasualtyProfile.md#prospicio.pricing.CasualtyProfile.rate) times them.


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


#### simulate()


Simulated years of events, with each loss's event (row index).


Usage


``` python
simulate(n_years, seed=0)
```


Year `i` draws from its own stream of the seed: a Poisson count, then for each event the row by its rate and its loss, so any year replays alone.


##### Parameters


`n_years: int`  

`seed: int = ``0`  


##### Returns


`tuple of (EventSet, list of list of int)`
