# Importance Sampling

One difficulty often encountered in sampling up-and-in call barrier options is that if the barrier is much higher that the spot price then a large number of the trajectories do not contribute to the average. To tackle this problem one requires large number of trajectories so that a reasonable proportion of them hit the barrier and the option price can be estimated with sufficient accuracy. However, this makes the sampling computationally intensive.

Another way around this problem is to use clever methods of sampling such as importance sampling. Importance sampling is a variance reduction technique which can be used effectively in simulation of rare events. The basic idea of applying importance sampling to rare event simulation is to sample from a modified distribution in which a rare event in consideration has a higher probability of occurrence. We can then normalise to compute the expectation with respect to the original probability distribution.

In our case we modify the transition rate matrix $$\Lambda$$ to $$\Lambda^c$$ by addiing a small drift $$c$$ towards the barrier so that a greater number of trajectories hit the barrier.

$$\Lambda_{ij}^{c}:=\begin{cases} \Lambda_{ij} & \text{if } j\geq H \\ \Lambda_{ij}+c & \text{if } i<j<H \\ \Lambda_{ii}-(H-i)c & \text{if } i=j \\ \Lambda_{ij} & \text{if } i>j \end{cases},$$

where $$H$$ is the barrier. Then we sample according to $$\Lambda^c$$ as described in the jump-diffusion section.