From d3c71035847d4c76f71ab81d8a6200323499d083 Mon Sep 17 00:00:00 2001 From: edknock Date: Thu, 7 Nov 2024 10:22:41 +0000 Subject: [PATCH 1/3] add bit about distributions --- index.qmd | 2 +- stochasticity.qmd | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/index.qmd b/index.qmd index 5dde57d..82c47fd 100644 --- a/index.qmd +++ b/index.qmd @@ -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 diff --git a/stochasticity.qmd b/stochasticity.qmd index e10d4e4..b1e6e18 100644 --- a/stochasticity.qmd +++ b/stochasticity.qmd @@ -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 From a20228c081d7cbb089d135779b077144598fadd9 Mon Sep 17 00:00:00 2001 From: edknock Date: Thu, 7 Nov 2024 10:31:00 +0000 Subject: [PATCH 2/3] remove heading --- stochasticity.qmd | 2 -- 1 file changed, 2 deletions(-) diff --git a/stochasticity.qmd b/stochasticity.qmd index b1e6e18..4de0556 100644 --- a/stochasticity.qmd +++ b/stochasticity.qmd @@ -127,8 +127,6 @@ draw from a Gamma distribution with a shape of 2 and a **scale** of 10. You may 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: * Seeding From 8ddd1a9bb50c9260b72a683fd7d7c60f532d6f6c Mon Sep 17 00:00:00 2001 From: edknock Date: Thu, 7 Nov 2024 15:42:21 +0000 Subject: [PATCH 3/3] more specific link --- stochasticity.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stochasticity.qmd b/stochasticity.qmd index 4de0556..77404af 100644 --- a/stochasticity.qmd +++ b/stochasticity.qmd @@ -125,7 +125,7 @@ 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). +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#distribution-functions). ## More sections to add: