*3.3. Approximation Algorithm*

Following the proof of Lemma 2 in Vatamidou et al. (2014), we can directly deduce the following result.

**Lemma 2.** *Let SH be the spectral cdf of the c.m. ladder height distribution H and S* ˆ *H a step function such that* <sup>D</sup>(*SH*, *<sup>S</sup>*<sup>ˆ</sup>*H*) ≤ *. Consequently,* <sup>D</sup>(*<sup>H</sup>*, *H*ˆ ) ≤ *, where H*ˆ *is the c.m. approximate ladder height distribution with spectral cdf S* ˆ *H.*

The above lemma states that if we want to approximate a c.m. ladder height distribution with a hyperexponential one with some fixed accuracy , it suffices to approximate its spectral cdf with a step function with the same accuracy. As pointed out in Remark 1 of Vatamidou et al. (2014), we could approximate *SH* with a step function having *k* jumps that occur at the quantiles *λi*, such that *SH*(*<sup>λ</sup>i*) = *i*/(*k* + <sup>1</sup>), *i* = 1, ... , *k* and are all of size 1/*k* to achieve <sup>D</sup>(*<sup>H</sup>*, *H*ˆ ) ≤ = 1/(*k* + <sup>1</sup>). Another possibility is to use the step function in Step 4d of our Algorithm 1; see also Figure 1 for a graphical representation of the approximate step function and its corresponding hyperexponential distribution. Clearly, this new step function leads to <sup>D</sup>(*<sup>H</sup>*, *H*ˆ ) ≤ = 1/2(*k* − <sup>1</sup>).

The error bound for the approximate ruin probability *ψ*<sup>ˆ</sup>(*u*) can be calculated afterwards through Theorem 1. An interesting question in this context is how many phases *k* for the approximate ladder height distribution suffice to guarantee an error bound 11*ψ*(*u*) − *ψ*<sup>ˆ</sup>(*u*)11 ≤ *δ* for some predetermined *δ* > 0. We answer this question in the next lemma.

**Figure 1.** Approximating the ladder height distribution with a hyperexponential one with 6 phases to achieve accuracy = 0.1, under Pareto(2, 3) claim sizes. On the **left** graph, the purple dashed line corresponds to the spectral cdf *SH* and the red solid line to its approximate step function *S* ˆ *H*, whereas on the **right** graph we see *H* and *H* ˆ , respectively.

**Lemma 3.** *To achieve* 11*ψ*(*u*) − *ψ*<sup>ˆ</sup>(*u*)11 ≤ *δ for some predetermined δ* > 0*, the ladder height distribution <sup>H</sup>*(*u*) *must be approximated by a hyperexponential one with at least k phases, such that*

$$k = k(u) = \left\lceil \min \left\{ \frac{\phi \left( 1 - \phi + \delta \left( 1 - \phi H(u) \right) \right)}{2\delta \left( 1 - \phi H(u) \right)^2}, \frac{\phi}{2\delta \left( 1 - \phi \right)} \right\} \right\rceil + 1,\tag{12}$$

*where x is the integer that is greater than or equal to x but smaller than x* + 1*.*

**Proof.** Observe that the error bound in Theorem 1 depends on the approximate hyperexponential distribution *H* ˆ (*u*), which means that one should first determine *H*ˆ (*u*) and then calculate the error bound. However, when <sup>D</sup>(*<sup>H</sup>*, *H*ˆ ) ≤ , this translates to *<sup>H</sup>*(*u*) − ≤ *H*ˆ (*u*) ≤ *<sup>H</sup>*(*u*) + . Therefore, the worst-case scenario for the bound is when *H* ˆ (*u*) = *<sup>H</sup>*(*u*) + and consequently <sup>D</sup>(*<sup>H</sup>*, *H*ˆ ) = . As a result, if we want to achieve 11*ψ*(*u*) − *ψ*<sup>ˆ</sup>(*u*)11 ≤ *δ* for all possible scenarios of *H*ˆ (*u*), we should solve the inequality

$$\frac{\epsilon (1 - \phi)\phi}{\left(1 - \phi H(\mu)\right)\left(1 - \phi H(\mu) - \phi \epsilon\right)} \le \delta\_\prime$$

with respect to . By substituting = 1/2(*k* − <sup>1</sup>), we calculate

$$k \ge \frac{\phi\left(1 - \phi + \delta\left(1 - \phi H(\mu)\right)\right)}{2\delta\left(1 - \phi H(\mu)\right)^2} + 1.$$

In addition, the bound is asymptotically equal to *φ*/(1 − *φ*) according to Remark 1. Consequently, it must also hold that

$$\frac{\epsilon\phi}{1-\phi} \le \delta \quad \Rightarrow \quad k \ge \frac{\phi}{2\delta(1-\phi)} + 1.$$

Finally, as the number of phases *k* must be an integer, the smallest possible integer that satisfies at least one of the inequalities is the one described in Equation (12).

After this, we present our algorithm under the setting that we fix the desired accuracy *δ* for the approximation of the ruin probability *ψ*<sup>ˆ</sup>(*u*).
