2.13.1. Grübel and Hermesmeier (1999)
2.13.1.1. Poisson/Levy Example
Here is an example from Grübel and Hermesmeier [1999].
The Levy distribution is a zero parameter distribution in scipy.stats. The paper considers an aggregate with Poisson(20) claim count.
The Panjer recursion column can be replicated using more buckets and padding with bs=1. The function exact uses conditional probability to
compute the aggregate probability of \(x-1/2 < X < x+1/2\) exactly. The Levy is stable with index \(\alpha=1/2\), which means that
\[X_1 + \cdots + X_n =_d n^2X\]
for iid Levy variables.
The other models use log2=10, no padding, and varying amounts of tilting.
In [1]: from aggregate import build, qd
In [2]: from scipy.stats import levy
In [3]: a = build('agg L 20 claim sev levy poisson', update=False)
In [4]: bs = 1
In [5]: a.update(log2=16, bs=bs, padding=2, normalize=False, tilt_vector=None)
In [6]: df = a.density_df.loc[[1, 10, 100, 1000], ['p_total']] / a.bs
In [7]: df.columns = ['accurate']
In [8]: def exact(x):
...: lam = 20
...: n = 100
...: p = np.zeros(n)
...: a = np.zeros(n)
...: p[0] = np.exp(-lam)
...: fz = levy()
...: for i in range(1, n):
...: p[i] = p[i-1] * lam / i
...: a[i] = fz.cdf((x+0.5)/i**2) - fz.cdf((x-0.5)/i**2)
...: return np.sum(p * a)
...:
In [9]: df['exact'] = [exact(i) for i in df.index]
# other models
In [10]: log2 = 10
In [11]: for tilt in [None, 1/1024, 5/1024, 25/1024]:
....: a.update(log2=log2, bs=bs, padding=0, normalize=False, tilt_vector=tilt)
....: if tilt is None:
....: tilt = 0
....: df[f'tilt {tilt:.4f}'] = a.density_df.loc[[1, 10, 100, 1000], ['p_total']]/a.bs
....:
In [12]: qd(df.iloc[:, [1,0,2,3,4, 5]], accuracy=3)
exact accurate tilt 0.0000 tilt 0.0010 tilt 0.0049 tilt 0.0244
loss
1.0 1.0778e-07 2.4616e-07 0.00020645 7.3458e-05 1.5602e-06 2.4616e-07
10.0 3.0754e-05 3.4324e-05 0.00023799 0.00010668 3.5624e-05 3.4324e-05
100.0 0.0011555 0.0011559 0.0013212 0.0012148 0.0011569 0.0011559
1000.0 0.00020129 0.00020121 0.00021341 0.00020561 0.00020129 0.00020121
This table is identical to the table shown in the paper.