Skip to content

Commit

Permalink
add bit about distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
edknock committed Nov 7, 2024
1 parent dc04844 commit d3c7103
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is a book about writing models in the [`odin`](https://mrc-ide.github.io/od

## History

Originally, we designed odin around describing and solving systems of differential equations, with a small amount of support for working with discrete-time stochastic systems. Over time, and particularly during the COVID-19 response, we expanded the stochastic support and introduced the ability to fit these models using particle filters and other sequential Monte Carlo algorithms. You may have used `odin.dust` and `mcstate` through this period. As of 2024 we have rationalised our tools into a new set of packages which are currently called `odin2`, `dust2` and `monty2`
Originally, we designed odin around describing and solving systems of differential equations, with a small amount of support for working with discrete-time stochastic systems. Over time, and particularly during the COVID-19 response, we expanded the stochastic support and introduced the ability to fit these models using particle filters and other sequential Monte Carlo algorithms. You may have used `odin.dust` and `mcstate` through this period. As of 2024 we have rationalised our tools into a new set of packages which are currently called `odin2`, `dust2` and `monty`

## Installation

Expand Down
25 changes: 24 additions & 1 deletion stochasticity.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,32 @@ matplot(t, t(y$I), type = "l", lty = 1, col = "#00000044",

Here, we see some epidemics fail to take off, and a huge variation in where the peak is, with some trajectories only starting to take off at time 100 where in the previous example all were in decline.

## Supported random number functions

We have already seen use of Binomial draws, and we support other distributions. Support for the distributions includes both random draws and density calculations (more on that later). The support for these functions comes from `monty` and all the distributions are available for use in the both the `odin` DSL and the `monty` DSL (more on that also later).

Some distributions have several parameterisations; these are distinguished by the arguments to the functions. These distributions have a default parameterisation. For example, the Gamma distribution defaults to a `shape` and `rate` parameterisation so:

```r
a <- Gamma(2, 0.1)
a <- Gamma(shape = 2, rate = 0.1)
```

draw from a Gamma distribution with a shape of 2 and a **rate** of 0.1, while

```r
a <- Gamma(2, scale = 10)
a <- Gamma(shape = 2, scale = 10)
```

draw from a Gamma distribution with a shape of 2 and a **scale** of 10. You may find it is good practice to specify your arguments with such distributions whether using the default parameterisation or not.

Other supported distributions include the Normal, Uniform, Exponential, Beta and Poisson distributions. A full list of supported distributions and their parameterisations can be found [here](https://mrc-ide.github.io/odin2/articles/functions.html).

## Semantics of random number draws

## More sections to add:

* Supported random number functions
* Seeding
* Something on threads and parallelism
* Stochastic quantities vary over time

0 comments on commit d3c7103

Please sign in to comment.