A zero-coupon bond paying $1$ at maturity $T$ equals the expected pathwise discount factor:
$$P(0, T) = \mathbb{E}\Bigl[e^{-\int_0^T r_t\,dt}\Bigr]$$Accumulating exp(-Integral(r)) along simulated paths reproduces the exact affine formulas directly from the short-rate dynamics.
From pricing PDE to affine closed form
By the Feynman–Kac theorem [1, 2], the bond price $P(t, r)$ satisfies the backward pricing PDE with terminal payoff $P(T, r) = 1$:
$$\partial_t P + a(b - r)\partial_r P + \frac{1}{2}\sigma^2\partial_r^2 P = rP$$Both the Vasicek and Cox–Ingersoll–Ross (CIR) models belong to the affine class $P(0, T) = A(T)e^{-B(T)r_0}$:
- Vasicek: $B(T) = \frac{1 - e^{-aT}}{a}$ and $\ln A(T) = \bigl(b - \frac{\sigma^2}{2a^2}\bigr)(B(T) - T) - \frac{\sigma^2 B(T)^2}{4a}$ (with $a = 0.8$, $B(1) = 0.688$).
- CIR: with $\gamma = \sqrt{a^2 + 2\sigma^2}$, $B(T) = \frac{2(e^{\gamma T} - 1)}{(\gamma + a)(e^{\gamma T} - 1) + 2\gamma}$ and $A(T)$ given by the matching power-law ratio.
With $b = 4\%$, $r_0 = 3\%$, $T = 1$, and $100$ time steps, simulated path averages sit well within sampling error ($\text{SE} = 10^{-4}$) of the closed forms:
| Model | Parameters | Closed-form price (yield) | Simulated price |
|---|---|---|---|
| Vasicek | $a = 0.8,\ \sigma = 2\%$ | $0.96746$ ($3.31\%$) | $0.9673$ |
| CIR | $a = 1.5,\ \sigma = 0.1$ | $0.96580$ ($3.48\%$) | $0.9656$ |
Discretizing $\int_0^T r_t\,dt$ on the grid adds an $\mathcal{O}(\Delta)$ quadrature bias that remains smaller than the Monte Carlo error here.


Run this in sItô
Open sItô with this model pre-loaded to inspect the path distribution, summary statistics, and parameter sensitivities—or change any setting and rerun:
- Open Vasicek zero-coupon bond in sItô ↗ — evaluates
exp(-Integral(r))at $T = 1$ ($0.9673$ vs exact $0.96746$). - Open CIR zero-coupon bond in sItô ↗ — repeats the pathwise discount average under square-root volatility ($0.9656$ vs exact $0.96580$).
For how the underlying Vasicek and CIR rate distributions compare, see the short-rate comparison. Pathwise integral transforms are described in Compiling parametric SDEs into fast Monte Carlo simulations.
Related notes: Expected short rate versus yield · Yield-curve shapes from a two-factor Vasicek model