jsf_sir

< Back to Reference | View source

jsf_sir()

Simulate an SIR epidemic model using JSF

Usage

jsf_sir(
  N = 1000,
  I0 = 10,
  beta = 0.5,
  gamma = 0.1,
  t_max = 60,
  dt = 0.1,
  switching_threshold_I = 10
)

Arguments

Argument Description
N Total population size.
I0 Initial infectious population.
beta Infection rate.
gamma Recovery rate.
t_max Final simulation time.
dt Time step for the continuous/ODE part of JSF.
switching_threshold_I Switching threshold for the infectious compartment.

Value

A data frame with columns time, S, I, and R.

Description

This function runs a simple SIR epidemic model using the Python jsf package through reticulate.

Examples

if (interactive() && jsf_available()) {
  result <- jsf_sir(
    N = 1000,
    I0 = 10,
    beta = 0.5,
    gamma = 0.1,
    t_max = 1,
    dt = 0.1,
    switching_threshold_I = 10
  )

  head(result)
}