CIR with a switching mean level

A square-root intensity whose long-run level follows a regime.

The intensity follows $dx = \kappa(\theta_y - x)\,dt + \sigma\sqrt{x}\,dW$. The coefficient of $x$ in the bond price solves $B' = 1 - \kappa B - \tfrac12\sigma^2 B^2$, which does not involve $\theta$, so the state factors out whenever only the mean level switches:

$$B(t) = \frac{2\,(e^{ht} - 1)}{(h+\kappa)(e^{ht}-1) + 2h}, \quad h = \sqrt{\kappa^2 + 2\sigma^2}, \qquad g_i(t) = -\kappa\,\theta_i\,B(t).$$

Here $\kappa = 1.5$, $\theta = (0.08, 0.02)$ and $\sigma = 0.15$. The table gives the error in $a_1(3)$ after each order. $B$ is not a sum of exponentials, so the engine holds $g_i$ as a Chebyshev series.

switching rateorder 0order 1order 2order 3order 4order 5order 6
52.5e-37.1e-72.8e-72.0e-76.2e-94.4e-91.6e-10
101.2e-31.3e-72.3e-81.2e-81.2e-106.8e-118.5e-13
206.2e-42.8e-82.1e-97.5e-102.7e-121.1e-126.9e-15
403.1e-46.7e-92.2e-104.7e-116.9e-141.7e-146.7e-16

If $\sigma$ also switched, $B$ would differ between regimes and the state would no longer factor out.