Spatial SIR Model
An agent-based Monte Carlo simulation of epidemic spread with finite-time Lyapunov exponent analysis. Explore how spatial dynamics and chaos theory intersect in epidemiological modeling.
Spatial SIR Model: A Comprehensive Analysis
Overview and Background
The Spatial SIR (Susceptible-Infected-Recovered) model represents a fundamental extension of classical epidemic modeling that incorporates spatial dynamics and individual-level interactions. Unlike traditional compartmental models that treat populations as homogeneous, spatial SIR models explicitly account for the geographic distribution of individuals and their movement patterns.
This agent-based implementation simulates epidemic spread on a two-dimensional torus, where each individual (agent) can move freely and interact with nearby neighbors. The model captures the complex interplay between spatial structure, individual behavior, and epidemic dynamics that characterizes real-world disease transmission.
Mathematical Framework
Agent States and Transitions
Each agent \(i\) at time \(t\) is characterized by:
- Position: \mathbf{x}_i(t) = (x_i(t), y_i(t)) on the unit torus [0,1] \times [0,1]
- Velocity: \mathbf{v}_i(t) = (v_{x,i}(t), v_{y,i}(t)) with magnitude |v_i| and direction \theta_i
- State: s_i(t) ∈ {0, 1, 2} representing Susceptible, Infected, or Recovered
- Infection time: t_{I,i} for tracking recovery probability
Movement Dynamics
Agents undergo continuous random walk with small angular perturbations:
where \mathbf{R}(\xi_i) is a rotation matrix with angle \xi_i \sim \text{Uniform}(-\alpha, \alpha), and v_0 is the target speed.
Transmission Dynamics
Infection occurs when susceptible and infected agents are within interaction radius \(r\):
where d_{ij} is the torus distance between agents i and j, and \beta is the transmission rate.
Recovery Process
Infected agents recover according to an exponential process:
where \(\gamma\) is the recovery rate, independent of infection duration.
Chaos Theory and Lyapunov Analysis
The simulation implements a twin-system approach to measure the finite-time Lyapunov exponent (FTLE), a key indicator of chaotic behavior in dynamical systems. Two nearly identical systems are evolved with identical random seeds, and their divergence is tracked over time.
Twin System Methodology
The primary system and twin system are initialized with identical parameters except for a tiny perturbation in agent positions (\(\delta \sim 10^-5\)). Both systems use the same random number generator to ensure identical stochastic events.
Finite-Time Lyapunov Exponent Calculation
The FTLE is computed from the SIR state vectors rather than individual agent positions:
where \mathbf{S}_i(t) = (S_i(t), I_i(t), R_i(t)) represents the SIR counts of system i.
Interpretation of Lyapunov Exponents
- \(\lambda > 0\): Chaotic behavior - small perturbations grow exponentially
- \(\lambda = 0\): Neutral stability - perturbations neither grow nor decay
- \(\lambda < 0\): Stable behavior - perturbations decay exponentially
Computational Implementation
Spatial Grid Optimization
To efficiently handle the \(O(N^2)\) complexity of proximity detection, the simulation employs a uniform spatial grid:
- Grid cells: Size \(r \times r\) to capture all possible interactions
- Neighbor search: Only check agents in the 9-cell neighborhood (3×3 grid)
- Complexity reduction: From \(O(N^2)\) to \(O(N)\) for sparse systems
- Boundary handling: Torus topology with periodic boundary conditions
Integration Scheme
The simulation uses a semi-implicit Euler integration scheme:
This scheme provides good stability for the stochastic dynamics while maintaining computational efficiency.
Monte Carlo Statistical Analysis
The Monte Carlo framework enables statistical analysis of epidemic outcomes across multiple independent realizations. This approach is essential for understanding the variability inherent in stochastic epidemic processes.
Outbreak Definition
An outbreak is defined as a simulation where the peak infected fraction exceeds a threshold \(\theta\):
Statistical Measures
- Outbreak probability: P_outbreak = (Number of outbreaks) / (Total runs)
- Mean peak infection: ⟨I_peak⟩ = (1/M) × Σ I_peak^(i)
- Final epidemic size: ⟨R_final⟩ = (1/M) × Σ R_final^(i)
- Variance analysis: Confidence intervals and standard deviations for all measures
Epidemiological Applications
Disease Modeling
Spatial SIR models are particularly valuable for modeling diseases where spatial proximity is crucial for transmission, such as:
- Airborne diseases: Influenza, COVID-19, tuberculosis
- Vector-borne diseases: Malaria, dengue fever, Zika virus
- Contact diseases: Measles, chickenpox, norovirus
- Environmental diseases: Cholera, Legionnaires' disease
Public Health Interventions
The model can evaluate various intervention strategies:
- Social distancing: Reducing agent speed and interaction radius
- Quarantine: Removing infected agents from the population
- Vaccination: Converting susceptible agents directly to recovered
- Contact tracing: Targeted isolation of high-risk individuals
Mathematical Properties and Phase Transitions
Basic Reproduction Number
The effective reproduction number \(R_e\) in the spatial model depends on both transmission parameters and spatial structure:
where A is the total area and f_spatial accounts for spatial clustering effects.
Phase Transitions
The model exhibits different phases depending on parameter values:
- Endemic phase (\(R_e < 1\)): Disease dies out quickly
- Epidemic phase (\(R_e > 1\)): Large-scale outbreaks occur
- Critical phase (\(R_e \approx 1\)): Stochastic fluctuations dominate
Research Applications and Extensions
Network Epidemiology
The spatial model can be extended to include explicit contact networks, where agents interact only with their network neighbors. This bridges the gap between spatial and network-based epidemic models.
Multi-Scale Modeling
The agent-based approach naturally incorporates multiple scales:
- Individual level: Agent behavior and decision-making
- Local level: Neighborhood interactions and clustering
- Population level: Global epidemic patterns and statistics
- Temporal level: Short-term dynamics and long-term trends
Machine Learning Integration
The simulation generates rich datasets suitable for machine learning applications:
- Epidemic prediction: Using early-stage data to predict outbreak severity
- Parameter estimation: Inferring transmission parameters from observed data
- Intervention optimization: Finding optimal control strategies
- Pattern recognition: Identifying characteristic epidemic signatures
Limitations and Future Directions
Current Limitations
- Computational complexity: \(O(N^2)\) scaling limits population sizes
- Simplified behavior: Agents lack realistic decision-making processes
- Homogeneous mixing: All agents have identical interaction patterns
- Static parameters: No adaptation or learning mechanisms
Future Research Directions
- Heterogeneous populations: Age-structured models with varying susceptibility
- Adaptive behavior: Agents that modify behavior based on epidemic state
- Multi-pathogen dynamics: Co-circulating diseases with cross-immunity
- Real-world data integration: Incorporating actual mobility and contact patterns
- Machine learning optimization: AI-driven parameter tuning and intervention design
Interactive Features
Adjust transmission rate (β), recovery rate (γ), interaction radius, and agent speed to explore different epidemiological scenarios. The Monte Carlo analysis provides statistical insights into outbreak dynamics, while the Lyapunov exponent reveals the underlying chaotic nature of the system.