The continuous-time Cox–Ingersoll–Ross (CIR) [2] process stays nonnegative:
$$dx_t = \kappa(\theta - x_t)\,dt + \sigma\sqrt{x_t}\,dW_t$$Its Euler–Maruyama discretization can still step below zero whenever a negative Gaussian increment overwhelms the remaining state. With $\kappa = 2$, $\theta = 0.04$, $\sigma = 0.5$, $x_0 = 0.04$, horizon $T = 1$, and $100$ time steps, evaluating $\sqrt{x_n}$ directly turns $58\%$ of simulated paths into NaN—about $5{,}700$ paths out of $10^4$.
Two standard fixes keep every path finite:
- Absolute value: replace $\sqrt{x_n}$ with $\sqrt{|x_n|}$ in the diffusion coefficient.
- Full truncation: replace $x_n$ with $\max(x_n, 0)$ in both the drift $\kappa\bigl(\theta - \max(x_n, 0)\bigr)$ and the diffusion $\sigma\sqrt{\max(x_n, 0)}$.
Both schemes allow negative intermediate values (and leave roughly $4\%$ to $5\%$ of paths below zero at $T = 1$ on a $100$-step grid) [1], while keeping the terminal moments close to the exact law.
Comparison against the exact distribution
At $T = 1$, $x_1$ follows a non-central chi-square distribution. Because the Feller condition fails here ($2\kappa\theta = 0.16 < \sigma^2 = 0.25$), the true process touches zero, making boundary excursions common even in continuous time.
| Scheme | Mean | Variance | $P(x_1 < 5 \times 10^{-3})$ | Paths below zero |
|---|---|---|---|---|
| Exact law | $0.0400$ | $2.454 \times 10^{-3}$ | $0.2129$ | $0$ |
| Absolute value, $100$ steps | $0.0400$ | $2.51 \times 10^{-3}$ | $0.215$ | $5.2\%$ |
| Full truncation, $100$ steps | $0.0400$ | $2.49 \times 10^{-3}$ | $0.220$ | $4.3\%$ |
| Absolute value, $10^3$ steps | $0.0399$ | $2.43 \times 10^{-3}$ | $0.212$ | $1.3\%$ |
At $10^4$ paths, Monte Carlo standard errors are about $5 \times 10^{-4}$ for the mean, $3\%$ for the variance, $0.2$ percentage points for the negative fraction, and $0.4$ percentage points for $P(x_1 < 5 \times 10^{-3})$. A $4 \times 10^5$-path reference simulation confirms that both $100$-step schemes overstate variance by $1\%$ to $2\%$, while refining the grid to $10^3$ steps cuts the negative fraction to $1.3\%$ and removes the variance excess.

NaN, while preserving mean $0.040$. Open absolute-value fan in sItô ↗

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 absolute value (100 steps) in sItô ↗ — replaces $\sqrt{x_n}$ with $\sqrt{|x_n|}$ across $10^4$ paths.
- Open full truncation (100 steps) in sItô ↗ — applies $\max(x_n, 0)$ in both drift and diffusion.
- Open absolute value (1,000 steps) in sItô ↗ — finer grid ($10^3$ steps, $10^3$ paths) showing negative excursions drop toward $1.3\%$.
- Open plain sqrt(x) (100 steps) in sItô ↗ — unpatched Euler step where roughly $5{,}700$ of $10^4$ paths terminate in
NaN.
For the boundary condition behind zero crossings, see the Feller condition. Expression syntax is detailed in the sItô Reference, and the compiler architecture in Compiling parametric SDEs into fast Monte Carlo simulations.
Related notes: The Lamperti transform · Correlation in the Heston model