The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This vignette walks through a first example of setting up a multi-group epidemic model and calculating useful quantities for analysis using functions in this R package. After installing the package (see instructions in README), load it:
In our example model, we consider a population of size 10,000 individuals and with the following parameters:
contactmatrix that describes the relative
amount of contact that members of one group (row) has with each other
group (column). The contact matrix could be quantified directly, but we
recommend using one of the package functions to create it.In this example we use a model for “proportionate contacts with
preferential mixing”, making use of our
contactMatrixPropPref() function, which requires the
following components. This contact model can allows for different
overall contact rates of members of each group. Here we assume the
relative contact rates are 1 and 1.7 for groups A and B. This means that
an individual in Group B makes 1.7 contacts for every 1 made by an
individual in group A.
This contact model also can also assume preferential mixing within one’s own group. We assume that the fraction of contacts that are exclusively within-group is 0.2 for group A, and 0.5 for group B. For group A, this means that 20% of their contacts are exclusively with other members of group A, and the remaining 80% of contacts are split between both groups A and B at rates proportional to the population sizes and overall contact rates of each group. The latter element ensures that the overall number of A-to-B and B-to-A contacts are equal, for contact symmetry.
With the above elements, we calculate the contact matrix as follows
finalsize() function computes the final number of infected
people in each group at the end of the outbreak, by default using a
deterministic ordinary differential equation (ODE) model and numerically
solving the equations.finalsize(popsize, R0, contactmatrix, relsusc, reltransm, initR, initI, initV)
#> [1] 14139.571 8749.608Over one third of the infected individuals are from population B, despite the fact that they comprise only one fifth of the population.
finalsize(popsize, R0, contactmatrix, relsusc, reltransm, initR, initI, initV, method = "analytic")
#> [1] 14139.571 8749.609While the analytic method might seem preferable, it is not necessarily faster or more stable than the ODE numerical solution method, as the analytic method still involves numerical estimation methods required to solve the transcendental equations. We recommend using the default ODE method, especially for models with a large number of groups.
nsims argument, which defaults to 1 if
unspecified.finalsize(popsize, R0, contactmatrix, relsusc, reltransm, initR, initI, initV, method = "stochastic",
nsims = 10)
#> [,1] [,2]
#> [1,] 2 3
#> [2,] 4 9
#> [3,] 0 3
#> [4,] 0 1
#> [5,] 0 1
#> [6,] 14927 9068
#> [7,] 0 1
#> [8,] 3 3
#> [9,] 5 1
#> [10,] 14577 8763Each row of the output has the results of one of the stochastic simulations for the final outbreak size of each group (including the initial one case in group B). We see that some simulations end after no or a small number of transmissions due to random luck, while others grow to a size close to the final size result from the deterministic results above.
finalsize(popsize, R0, contactmatrix, relsusc, reltransm, initR, initI, initV, method = "hybrid",
nsims = 10)
#> [,1] [,2]
#> [1,] 0 1
#> [2,] 14140 8750
#> [3,] 0 3
#> [4,] 14140 8750
#> [5,] 0 1
#> [6,] 1 2
#> [7,] 0 1
#> [8,] 0 3
#> [9,] 0 1
#> [10,] 0 1These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.