---
title: Collection of SIR models for LibBi
author: Sebastian Funk
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Collection of SIR models for LibBi}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, echo=FALSE}
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

```{r deter_prev}
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

```{r deter_inc}
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

```{r stoch_sde}
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

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


# Example observation data frame

```r
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)
)
```
