13
Time-step choice, negative values and model conditions
A trustworthy SDE result requires more than code that runs: the time grid, state boundaries, coefficient conditions and sensitivity to numerical choices must be examined.
A valid equation does not guarantee a valid numerical path
Euler–Maruyama uses normal increments with unbounded support. Even when the true process should remain in \([0,N]\), a finite-step proposal can be negative or exceed \(N\). The risk grows near boundaries, with large diffusion, or with a large time step.
Time-step requirements
dt <= 0is invalid exactly because a step length cannot be zero or negative.- \(T/\Delta t\) should be handled consistently so the grid ends at the intended horizon.
- Results should be repeated with smaller steps to check numerical stability.
- A smaller step reduces discretisation error but increases computation.
This is different from checking whether a floating-point calculation is approximately zero; exact input conditions and computed numerical residuals require different tests.
Four boundary approaches
| Approach | Consequence |
|---|---|
| Stop and report | Exposes invalidity but produces incomplete paths. |
| Projection or clipping | Simple and bounded, but changes the Euler–Maruyama scheme. |
| Absorbing rule at zero | Represents extinction once zero is reached, but crossing behaviour remains numerical. |
| Alternative transformed or positivity-preserving method | Can respect structure better but requires a different numerical method. |
No correction should be applied silently.
Interactive sensitivity experiment
Run 500 SIS paths at three time steps. The code records every raw out-of-range proposal before applying the same declared projection rule.
Output
Run the code to see the result.
How to choose a practical time step
- Choose a plausible initial \(\Delta t\) from the biological time scale.
- Run the same outcome experiment with \(\Delta t/2\) and \(\Delta t/4\).
- Compare means, quantiles, extinction measures and correction frequency.
- Reduce the step until conclusions are acceptably stable for the question.
- Report the chosen step and diagnostic results.
Mathematical coefficient conditions
Standard Euler–Maruyama convergence theory commonly assumes sufficient regularity such as Lipschitz continuity and controlled growth of drift and diffusion. Square-root epidemic diffusion coefficients are not globally Lipschitz at zero, so boundary behaviour deserves particular care. A numerical plot alone is not a proof of convergence.
Validation checklist
- Initial compartments are non-negative and sum to \(N\).
- Parameters and event rates are non-negative.
- The time step is positive and the horizon is reached as intended.
- Population conservation errors are checked for multivariable models.
- Boundary corrections are counted and reported.
- Important outcomes remain stable under step refinement.
What this lesson adds
You can now distinguish model validity from numerical validity, diagnose raw invalid proposals, evaluate a declared boundary rule, perform step-refinement experiments and explain why epidemic square-root diffusions require care near extinction.