Collection of SIR models for LibBi

knitr::opts_chunk$set(
  cache = TRUE, fig.path = "figure/introduction/",
  cache.path = "cache/introduction/", fig.cap = "", fig.align = "center",
  message = FALSE, warning = FALSE
)
suppressPackageStartupMessages(library("rbi"))

Deterministic SIR model, observations of prevalence

model_str <- readLines("bi/SIR_deter_prev.bi")
cat(paste(model_str, "\n"))
sir_model <- bi_model(lines = model_str)

Deterministic SIR model, observations of incidence

model_str <- readLines("bi/SIR_deter.bi")
cat(paste(model_str, "\n"))
sir_model <- bi_model(lines = model_str)

Stochastic SIR model (SDE), observations of incidence

model_str <- readLines("bi/SIR_stoch_SDE.bi")
cat(paste(model_str, "\n"))
sir_model <- bi_model(lines = model_str)

Stochastic SIR model (jump), observations of incidence

model_str <- readLines("bi/SIR_stoch_jump.bi")
cat(paste(model_str, "\n"))
sir_model <- bi_model(lines = model_str)

Example observation data frame

obs <- data.frame(
  value = c(1, 6, 2, 26, 99, 57, 78, 57, 15, 9, 4, 1, 1, 1, 0, 2, 0), 
  time = c(0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112)
)


Try the rbi package in your browser

Any scripts or data that you put into this service are public.

rbi documentation built on Aug. 15, 2023, 5:07 p.m.