Skip to content

Commit 1832013

Browse files
authored
Merge pull request #16 from mrc-ide/fix-code-bg
Fix code background
2 parents e2bd007 + 0584d0d commit 1832013

File tree

7 files changed

+32
-2
lines changed

7 files changed

+32
-2
lines changed

common.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ r_output <- function(x) {
1717
}
1818

1919
plain_output <- function(x) {
20-
lang_output(x, "")
20+
lang_output(x, "md") # not great, but at least renders nicely
2121
}

differentiability.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# Differentiability
22

3+
```{r}
4+
#| include: false
5+
source("common.R")
6+
```
7+
38
Random walk suppression and other uses

installation.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Installation
22

3+
```{r}
4+
#| include: false
5+
source("common.R")
6+
```
7+
38
Package installation is hard, let's go shopping.
49

510
## Packages

monty.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Monty
22

3+
```{r}
4+
#| include: false
5+
source("common.R")
6+
```
7+
38
Before showing how to fit odin models to data, we'll focus for a bit on monty itself. If you are anxious to get on and fit the model from @sec-data-filter, you might skip ahead to @sec-inference, where we resume this.
49

510
There are a bunch of things we want to cover in this chapter so likely it will be split into a few:

odin.qmd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ library(odin2)
1313

1414
## A simple example {#sec-odin-sir}
1515

16-
Here is a small system of equations for an "SIR" (Susceptible-Infected-Recovered) model, implemented as a set of ordinary differential equations:
16+
Here is a small system of differential equations for an "SIR" (Susceptible-Infected-Recovered) model:
17+
18+
\begin{gather*}
19+
\frac{dS}{dt} = -\beta S \frac{I}{N}\\
20+
\frac{dI}{dt} = \beta S \frac{I}{N} - \gamma I\\
21+
\frac{dR}{dt} = \gamma I
22+
\end{gather*}
23+
24+
And here is an implementation of these equations in `odin`:
1725

1826
```{r}
1927
sir <- odin({

references.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# References {.unnumbered}
22

3+
```{r}
4+
#| include: false
5+
source("common.R")
6+
```
7+
38
::: {#refs}
49
:::

stochasticity.qmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ sir <- odin({
6161

6262
This is a discrete-time model (using `update()` and not `deriv()`) as stochastic models must run in discrete time. We use `dt` to scale the rates, and adjusting `dt` will change the way that stochasticity affects the dynamics of the system.
6363

64+
The call to `Binomial()` samples from a binomial distribution, returning the number of successes from `S` (or `I`) draws, each with probability `p_SI` (or `p_IR`).
65+
6466
```{r}
6567
sir
6668
```

0 commit comments

Comments
 (0)