Conversation
|
Thanks for adding. I'll take a look asap. |
| ::: {.alert .alert-primary} | ||
| **Glossary** | ||
|
|
||
| * Outbreak _size_: the total number of cases produced by an outbreak before it goes extinct. | ||
|
|
||
| * Outbreak _length_: the total (maximum) number of generations reached by a outbreak before it goes extinct. | ||
| ::: |
There was a problem hiding this comment.
This has already been defined severally in the docs, including here. Might be better to link to them.
| * Outbreak _length_: the total (maximum) number of generations reached by a outbreak before it goes extinct. | ||
| ::: | ||
|
|
||
| In this vignette we will outline how to show the distribution of outbreak sizes and lengths using the _epichains_ R package. |
There was a problem hiding this comment.
| In this vignette we will outline how to show the distribution of outbreak sizes and lengths using the _epichains_ R package. | |
| In this vignette we will outline how to generate a distribution of outbreak sizes and lengths using the _epichains_ R package. |
|
|
||
| ## Simulating an outbreak size distribution | ||
|
|
||
| First, we'll simulate the outbreak size distribution using the a Poisson offspring distribution. This is a simple one parameter distribution where the mean and variance of the distribution defined by $\lambda$ which is equal to the reproduction number ($R$). |
There was a problem hiding this comment.
We don't want to offend Siméon Denis Poisson.
| First, we'll simulate the outbreak size distribution using the a Poisson offspring distribution. This is a simple one parameter distribution where the mean and variance of the distribution defined by $\lambda$ which is equal to the reproduction number ($R$). | |
| First, we'll simulate the outbreak size distribution using the a Poisson offspring distribution. This is a one-parameter distribution with an equal mean and variance, defined by $\lambda$. | |
| In this use case, $\lambda$ is equal to the reproduction number ($R$). |
| R <- seq(0.1, 1.0, 0.1) | ||
| ``` | ||
|
|
||
| We will create a parameter space will each combination of parameters. In this simple outbreak size simulation, only the reproduction number varies. |
There was a problem hiding this comment.
| We will create a parameter space will each combination of parameters. In this simple outbreak size simulation, only the reproduction number varies. | |
| We will create a parameter space with each combination of parameters. In this simple outbreak size simulation, only the reproduction number varies. |
| ) | ||
| ``` | ||
|
|
||
| The branching process is stochastic so we need to specify how many simulation model replicates to run to capture the stochasticity in the epidemic. This is important, as mentioned above as a factor that influences outbreak size, the same epidemic transmissibility parameters can result in different sized outbreaks depending on randomness, such as the number of infectees from a given infector. |
There was a problem hiding this comment.
| The branching process is stochastic so we need to specify how many simulation model replicates to run to capture the stochasticity in the epidemic. This is important, as mentioned above as a factor that influences outbreak size, the same epidemic transmissibility parameters can result in different sized outbreaks depending on randomness, such as the number of infectees from a given infector. | |
| Branching processes are stochastic processes, so we need to specify how many simulation model replicates to run to capture the variability in the epidemic. This is important, as mentioned above as a factor that influences outbreak size, the same epidemic transmissibility parameters can result in different sized outbreaks depending on randomness, such as the number of infectees from a given infector. |
| ``` | ||
|
|
||
| Here we choose to simulate each scenario `r n_chains` times. | ||
|
|
There was a problem hiding this comment.
This needs a leading statement.
| ```{r, define-breaks} | ||
| breaks <- c(0, 2, 5, 10, 20, 50, 100, Inf) | ||
| ``` | ||
|
|
There was a problem hiding this comment.
This needs a leading statement.
| outbreak_list <- vector(mode = "list", length = nrow(scenarios)) | ||
| for (i in seq_len(nrow(scenarios))) { | ||
| offspring_dist_fun <- match.fun(scenarios[i, "offspring_dist"]) | ||
| outbreak_list[[i]] <- epichains::simulate_chain_stats( |
There was a problem hiding this comment.
| outbreak_list[[i]] <- epichains::simulate_chain_stats( | |
| outbreak_list[[i]] <- simulate_chain_stats( |
|
|
||
| Instead of looking at the outbreak size distribution, i.e. the total number of cases in an outbreak, we may instead be interested in the outbreak _length_ distribution. This is the distribution of the number of generations that an epidemic reaches before going extinct. | ||
|
|
||
| We can follow the same procedure as for the outbreak size, but specify `stasitics = "length` in the `simulate_chain_stats()` function. We use the same parameters as the outbreak size simulation above, simulating with a Poisson offspring distribution. |
There was a problem hiding this comment.
| We can follow the same procedure as for the outbreak size, but specify `stasitics = "length` in the `simulate_chain_stats()` function. We use the same parameters as the outbreak size simulation above, simulating with a Poisson offspring distribution. | |
| We can follow the same procedure as for the outbreak size, but specify `statistic = "length"` in the `simulate_chain_stats()` function. We use the same parameters as the outbreak size simulation above, simulating with a Poisson offspring distribution. |
|
|
||
| We do not repeat the example of simulating an outbreak length distribution using a Negative binomial distribution, but this can be achieved using the code from the examples above, setting `statistic = "length"`. | ||
|
|
||
| ## Simulating an outbreak size distribution excluding the index case |
There was a problem hiding this comment.
I think this section doesn't need to be long as it's quite intuitive. It can be a sentence or two explaining the use case and how it can be done in code, i.e., just subtract 1 case.
| @@ -0,0 +1,318 @@ | |||
| --- | |||
| title: "Outbreak size and length distribution" | |||
There was a problem hiding this comment.
| title: "Outbreak size and length distribution" | |
| title: "Simulating scenarios of outbreak size and length" |
There was a problem hiding this comment.
Thanks for adding this vignette here, @joshwlambert.
I've gone through and left some comments.
My main comment is that this vignette applies a key function simulate_chain_stats() to answer a predictable question and is potentially more suited as a howto guide than as a vignette.
I made a similar decision with a previous vignette I was working on here. I am trying to keep the documentation/vignettes here focused on the package's functions and usage and transferring all applications and use cases to the howto guides.
These decisions are in line with the diataxis framework that we apply.
Let me know you think.
|
Thanks for the review @jamesmbaazam. I agree with your assessment on the vignette being more so a how-to guide than an explanation which would be more in the scope of a vignette. I will make a few minor adjustments and incorporate your suggestions, but then I can transfer this to a PR on howto and close this PR. |
|
Hi @joshwlambert, I'm doing some clean up on this repo and just following up on this PR to see if it has been transferred to the howto's and whether it's safe to close it now. Thanks. |
NEWS.mdThis PR adds a draft of a vignette describing how to plot the outbreak size and length distributions using {epichains}.
This PR supersedes PR #275 by documenting how users can easily achieve these outbreak distribution plots without requiring a new function in {epichains}.
@jamesmbaazam I've opened this as a draft PR. Please can you let me know if you're happy with the structure, scope and contents of the vignette. If so I'll refine the document and make the PR live. If there are more major revisions required let me know and we can discuss what needs to be worked on.
No.