# Estimating Tail Probabilities of Random Sums of Phase-Type Scale Mixture Random Variables +
## 3 Simulation Methods
### Asmussen-Kroese-Type Algorithm
#### 3.1.2 Hazard Rate Twisting  
In this section, we consider the case in which scaling distributions are heavy-tailed. Writing the PDF of the scaling random variable \(W\) as \(h\), its hazard rate is denoted by \(\lambda(w)=h(w)/\overline{H}(w)\). Let \(\Lambda(w)=\int_{0}^{w}\lambda(y)\mathrm{d}y=-\mathrm{ln}\overline{H}(w)\) denote the hazard function. Reference [8] introduced hazard rate twisting and the hazard rate twisted density with parameter \(\theta\), \(0\leq\theta<1\):  
\[h_{\theta}(w)=\frac{h(w)\,\mathrm{e}^{\theta\Lambda(w)}}{\tilde{M}(\theta)}\,,\]  
where \(\tilde{M}(\theta)\equiv\int_{0}^{\infty}h(w)\,\mathrm{e}^{\theta\Lambda(w)} \mathrm{d}w\), which is the normalisation constant. The resulting twisted PDF is  
\[h_{\theta}(w)=\lambda(w)(1-\theta)\,\mathrm{e}^{-\int_{0}^{\infty}(1-\theta) \lambda(y)\mathrm{d}y},\;\;w\geq 0\,,\]  
where \(\theta\equiv 1-n/\Lambda(u)\).  
The following equation will later be useful to compute the twisted tail probability:  
\[\overline{H}_{\theta}(w) = \int_{w}^{\infty}\lambda(t)(1-\theta)\,\mathrm{e}^{-\int_{0}^{t} (1-\theta)\lambda(y)\mathrm{d}y}\mathrm{d}t \tag{11}\] \[= \int_{w}^{\infty}(1-\theta)\frac{h(t)}{\overline{H}(t)}\,\mathrm{ e}^{-(1-\theta)(-\ln\overline{H}(t))}\mathrm{d}t\] \[= \left[\overline{H}(w)\right]^{1-\theta}.\]  
Thus, conditioning on \(N=n\), and taking in to account \(\mathbb{E}[X]\), the likelihood ratio of a single element associated with this change of measure is  
\[\frac{h(W)}{h_{\theta}(W)}=\frac{1}{1-\theta(n)}\,\mathrm{e}^{-\theta(n) \Lambda(W)}\,,\]  
where \(\theta(n)=1-n/\Lambda(u/\mathbb{E}[X])\).  
Combining the estimator (3) with the above importance sampling method for heavy-tailed scaling distributions, we then arrive at the following estimator for a single replicate:  
\[\widehat{\ell}_{\text{ConAK1+IS}}(u)=N\,\overline{F}\!\left(\frac{Z_{N-1}^{ \star}\vee(u-S_{N-1})}{W_{N}}\right)\times\frac{h(W_{N})}{h_{\theta}(W_{N})}\,. \tag{12}\]  
Since \(N\) is random, we combine the estimator above with a control variable, and this yields the estimator:  
\[\widehat{\ell}_{\text{ConAK1+IS+CV}}(u)=N\,\overline{F}\!\left(\frac{Z_{N-1}^{ \star}\vee(u-S_{N-1})}{W_{N}}\right)\times\frac{h(W_{N})}{h_{\theta}(W_{N})}- (N-\mathbb{E}[N])\,\overline{F}\!\left(\frac{u}{W_{N}}\right)\times\frac{h(W_ {N})}{h_{\theta}(W_{N})}\,. \tag{13}\]  
Note that Equations (12) and (13) have the same form as Equations (6) and (7), respectively. When we combine with the importance sampling method in this section, we exploit the hazard rate twisting method instead of the exponential twisting method.  
Conditional (either on \(W_{N}\) or on \(X_{N}\)) Asmussen-Kroese with importance sampling and control variate results are summarised in Algorithms 1 and 2 used to generate a single replicate.  
Note that we replace \(u\) by \(Z_{N-1}^{\star}\vee(u-S_{N-1})\) when determining \(\theta\), since we perform change of measure only on \(Z_{N}\).  
```
1. Generate \(N\).
2. Generate \(Z_{1},\ldots,Z_{N-1}\) as \(Z_{i}=W_{i}\,X_{i}\) with \(W_{1},\ldots,W_{N-1}\stackrel{{\mathrm{i.i.d}}}{{\sim}}H\) and \(X_{1},\ldots,X_{N-1}\stackrel{{\mathrm{i.i.d}}}{{\sim}}F\).
3. Compute \(S_{N-1}=\sum_{i=1}^{N-1}Z_{i}\), find \(Z_{N-1}^{\star}\vee(u-S_{N-1})\), and determine \(\theta\) from \(\zeta^{\prime}(\theta)=(Z_{N-1}^{\star}\vee(u-S_{N-1})/\mathbb{E}[X_{N}]\) (light-tailed \(W_{N}\)) or \(\theta=1-1/\Lambda((Z_{N-1}^{\star}\vee(u-S_{N-1})/\mathbb{E}[X_{N}])\) (heavy-tailed \(W_{N}\)).
4. Generate \(W_{N}\sim H_{\theta}\) and compute the likelihood ratio \(L:=\mathrm{e}^{\zeta(\theta)-\theta W_{N}}\) (light-tailed \(W_{N}\)) or \(L:=(1-\theta)^{-1}\mathrm{e}^{-\theta\Lambda(W_{N})}\) (heavy-tailed \(W_{N}\)).
5. Return \(\widehat{\ell}_{\text{ConAK1+IS+CV}}(u)=N\overline{F}\Big{(}\frac{Z_{N-1}^{ \star}\vee(u-S_{N-1})}{W_{N}}\Big{)}\times L-(N-\mathbb{E}[N]\Big{)}\, \overline{F}(\frac{u}{W_{N}})\times L\).
```  
**Algorithm 1** Conditional (on \(W_{N}\)) Asmussen-Kroese with importance sampling and control variate algorithm