Description Usage Arguments Details Value Examples
In EpiModel simulations, current states of the network are often stored. As an example, the number of individuals in the network and the number of infected individuals are stored in the epi object of dat. If you wish to calculate the prevalence (number infected / number of individuals) from these two values, this can be done using the make_new_epi function.
1 | make_new_epi(dat, args, FUN, new_name)
|
dat |
The dat object that contains the epi information |
args |
The names of the epi measure used to calculate the new epi measure. |
FUN |
The function used to calculate the new epi measures. The number of arguments should be the same as the length of args list. |
new_name |
Name of the new epi measure should end with ".". |
**Why not just do this manually?** While this calculation can be done manually, it can become cumbersom if you wish to calculate a new epi measure among many different subgroups. This function automatically calculates the new epi measure for each subgroup for which all the required epi measures (in the above example number infected and number of individuals) are defined.
a dat object with the addition of the epi measures with names given by new_name (along with the attribute name).
1 2 3 4 5 6 7 8 9 10 11 | ## NOT RUN
dat <- list("epi" = list(
"num.B" = c(1, 3, 4, 10, 20),
"num.O" = c(20, 25, 50, 55, 60),
"num.new.i.B" = c(0, 0, 1, 0, 1),
"num.new.i.O" = c(2, 0, 2, 0, 2))
)
dat <- make_new_epi(dat, c("num.new.i."), function(x){cumsum(x)}, "num.i.")
dat$epi$num.new.i.O
dat <- make_new_epi(dat, c("num.", "num.i."), function(x, y){y / x}, "prev.")
dat$epi$prev.O
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.