IONISE is a user-friendly computational package developed for the gamma model approach, specifically targeting the SEIR (Susceptible-Exposed-Infectious-Removed) model. The package is implemented in R software version 4.3.2 and aims to estimate epidemiological parameters from sole confirmed case data using gamma-distributed latent and infectious periods.
- R software version 4.3.2 or higher
- Additional R packages:
deSolveMASSmvtnormdplyrinvgammaramcmc
Source functions are modularized with four modules below:
IONISE_module_basic_computing.R: This module contains basic functions for the packages, such as calculating probability density functions and convolutions between density functions.IONISE_module_diff_eqs.R: This module contains numerical solvers for differential equations describing the SEIR and extended SEIR models with delays.IONISE_module_MH.R: This module contains functions for the Metropolis-Hastings (MH) algorithm used in Markov chain Monte Carlo (MCMC) sampling.IONISE_module_MCMC.R: This module contains functions performing MCMC sampling.
- Download the IONISE package and example CSV files from the GitHub repository (link will be activated after acceptance).
- Save confirmed case data as a CSV file with the name
input_data.csvin the folder containing the R code of the main function,IONISE_main.R.
- Open
IONISE_main.Rin your R environment. - Set the folder containing the R code as the working directory using the function
setwd(). - Install and load the required packages:
install.packages(c("deSolve", "MASS", "mvtnorm", "dplyr", "invgamma", "ramcmc")) library(deSolve) library(MASS) library(mvtnorm) library(dplyr) library(invgamma) library(ramcmc)
- Compile the necessary function libraries using the line
source("IONISE_source.R"). - Import the input data CSV file using the line
read.csv("input_data.csv").
For more details, refer to a step-by-step manual provided in the relevant reference (Supplementary Note 2).
- Set the variable
initial_phasetoTRUEif the data comes from the initial phase of disease spread; otherwise, set it toFALSE. - Specify whether to estimate the infectious period distribution (
estim_infect).- If
TRUE, the code will estimate shape and scale parameters (k_(τ_I),s_(τ_I)). - If
FALSE, specify the mean and variance of the infectious period distribution (infect_mean,infect_var).
- If
- Specify the parameters for the MCMC procedure. The variable
nrepeatrepresents the number of MCMC iterations, and the variabletun_betarepresents the proposal variance for the Metropolis-Hastings algorithm for sampling theβ. The default values fornrepeatandtun_betaare 10,000 and 0.1, respectively. - Specify the distribution type for the delays (i.e., latent and infectious periods) in the model using the variable
dist_type. The variable is one ofexp,gamma,invgamma,lognormal, andweibull. - Specify the type of the likelihood function for the inference using the variable
lik_type. The variable is one ofpoissonandgaussian. - Set up hyperparameters for prior distributions:
- Transmission rate (
prior_mean_beta,prior_var_beta). - Infectious period (
prior_mean_infect_shape,prior_mean_infect_scale,prior_var_infect_shape,prior_var_infect_scale). - Default values are non-informative priors (mean=1, variance=1,000,000).
- Transmission rate (
- Specify the type of a model used for the inference using the variable “model_type.” If the variable is
SEIR, the SEIR model is used for the inference. If the variable isExtended_SEIR, the extended model is used for the inference. See the relevant reference to see descriptions of the SEIR model and the extended model. - In the code section
PART 2-1orPART 2-2, specify the initial values of the compartment and the values of the parameters in the chosen model. - Run the code section named
PART 3: Perform MCMC.
Once IONISE_main.R is properly executed, a CSV file named post_samples.csv is created. This file contains posterior samples of β, k_(τ_I), s_(τ_I), μ_(τ_I), and R in the first, second, third, fourth, and fifth columns, respectively. Note that the burn-in period and thinning for the MCMC iterations are not automatically applied in the code. To obtain independent posterior samples from the MCMC iterations, users may need to apply the burn-in period and thinning.
- Installation: Less than 10 seconds.
- Execution: Approximately 1 hour per 10,000 MCMC iterations for the example data when it the code tested with MacBook Air (2023) running macOS Sonoma (14.4.1) with processor M2 8-Core with R version 4.3.2 (2023-10-31).
- To be updated.