Table of Contents
Fetching ...

Performance comparison of Python, MATLAB and R for numerical solutions of SI and SIR epidemiological models

Berkay Özışık, Elif Demirci

TL;DR

Solving the SI and SIR models using Euler's method, RK4, and P-C methods in Python, MATLAB, and R to provide a comparative perspective on the accuracy and run-time performance across different software and numerical methods.

Abstract

Mathematical modeling plays a vital role in epidemiology, offering insights into the spread and control of infectious diseases. The compartmental models developed by Kermack and McKendrick, particularly the SI (Susceptible-Infected) and SIR (Susceptible-Infected-Recovered) models, form the basis of many epidemic studies. While some simple cases permit analytical solutions, most real-world models require numerical methods such as Euler's method, the fourth-order Runge-Kutta (RK4) method, and Predictor-Corrector (P-C) methods. These methods are typically implemented in scientific computing software like Python, MATLAB, and R. However, the computational efficiency and run-time performance of these software tools in solving epidemiological models have not been comprehensively compared in the literature. This study addresses this gap by solving the SI and SIR models using Euler's method, RK4, and P-C methods in Python, MATLAB, and R. Execution times are recorded for each implementation to evaluate computational efficiency. Additionally, for the SI model, where an exact analytical solution exists, R2 values are computed to assess numerical accuracy. For the SIR model, a high-accuracy reference solution is obtained by solving the system using MATLAB's ODE45 solver, and the SIR solutions computed via the RK4 method in MATLAB are compared against this reference. The results provide a comparative perspective on the accuracy and run-time performance across different software and numerical methods, offering practical guidance for researchers and practitioners in selecting suitable tools for epidemic modeling.

Performance comparison of Python, MATLAB and R for numerical solutions of SI and SIR epidemiological models

TL;DR

Solving the SI and SIR models using Euler's method, RK4, and P-C methods in Python, MATLAB, and R to provide a comparative perspective on the accuracy and run-time performance across different software and numerical methods.

Abstract

Mathematical modeling plays a vital role in epidemiology, offering insights into the spread and control of infectious diseases. The compartmental models developed by Kermack and McKendrick, particularly the SI (Susceptible-Infected) and SIR (Susceptible-Infected-Recovered) models, form the basis of many epidemic studies. While some simple cases permit analytical solutions, most real-world models require numerical methods such as Euler's method, the fourth-order Runge-Kutta (RK4) method, and Predictor-Corrector (P-C) methods. These methods are typically implemented in scientific computing software like Python, MATLAB, and R. However, the computational efficiency and run-time performance of these software tools in solving epidemiological models have not been comprehensively compared in the literature. This study addresses this gap by solving the SI and SIR models using Euler's method, RK4, and P-C methods in Python, MATLAB, and R. Execution times are recorded for each implementation to evaluate computational efficiency. Additionally, for the SI model, where an exact analytical solution exists, R2 values are computed to assess numerical accuracy. For the SIR model, a high-accuracy reference solution is obtained by solving the system using MATLAB's ODE45 solver, and the SIR solutions computed via the RK4 method in MATLAB are compared against this reference. The results provide a comparative perspective on the accuracy and run-time performance across different software and numerical methods, offering practical guidance for researchers and practitioners in selecting suitable tools for epidemic modeling.
Paper Structure (7 sections, 23 equations, 6 figures, 4 tables)

This paper contains 7 sections, 23 equations, 6 figures, 4 tables.

Figures (6)

  • Figure 1: The graphs of the exact solution and the numerical solutions of the SI model in Python, using Euler's method, RK4 method and the P-C method.
  • Figure 2: The graphs of the exact solution and the numerical solutions of the SI model in MATLAB, using Euler's method, RK4 method and the P-C method.
  • Figure 3: The graphs of the exact solution and the numerical solutions of the SI model in R, using Euler's method, RK4 method and the P-C method.
  • Figure 4: The graphs of the numerical solutions of the SIR model in Python, using Euler's method, RK4 method and the P-C method.
  • Figure 5: The graphs of the numerical solutions of the SIR model in MATLAB, using Euler's method, RK4 method and the P-C method.
  • ...and 1 more figures