Learn R Programming

EpiModel (version 0.95)

merge.epiNet.simTrans: Merge Model Simulations Across epiNet.simTrans Objects

Description

This function merges data from two independent epiNet.simTrans simulations.

Usage

## S3 method for class 'epiNet.simTrans':
merge(x, y, keep.trans = TRUE,
  keep.network = TRUE, keep.stats = TRUE, ...)

Arguments

x
an EpiModel object of class epiNet.simTrans.
y
another EpiModel object of class epiNet.simTrans, with the identical model parameterization as x.
keep.trans
if TRUE, keep in the merged output the transmission data frames in trans and the status matrix in stat.mat (not only not using temporally extended attributes) from the original x and y
keep.network
if TRUE, keep in the merged output the networkDynamic objects from the original x and y elements.
keep.stats
if TRUE, keep in the merged output the network statistics (as set by the stats.formula parameter in epiNet.simTrans) from the original x and y elements.
...
additional arguments required by generic merge method, but not used.

Details

The purpose of this generic merge function is to facilitate analysis of multiple simulations of epiNet.simTrans class models that may have been simulated under different function calls, but where the model parameterization between the two calls is exactly the same. Such a situation would occur when one runs sets of simulations in parallel across computing clusters for efficency.

Note that this merge function does not work the same as the default merge function in generating a combined object where the structure differs between the individual elements: instead, the function checks that objects are identical in model parameterization in every respect except number of simulations.

Examples

Run this code
nw <- network.initialize(n = 100, directed = FALSE)
dissolution <- ~offset(edges)
coef.diss <- dissolution.coefs(dissolution, duration=10)
est <- epiNet.est(nw,
                  formation = ~ edges,
                  dissolution = ~offset(edges),
                  target.stats = 25,
                  coef.diss = coef.diss,
                  save.stats = FALSE, verbose = FALSE)
nwsims <- epiNet.simNet(est, nsteps = 10, verbose = FALSE)

x <- epiNet.simTrans(nwsims, type = "SI",
                     i.num = 1, trans.rate = 0.9,
                     sims.per.nw = 2, verbose = FALSE)
y <- epiNet.simTrans(nwsims, type = "SI",
                     i.num = 1, trans.rate = 0.9,
                     sims.per.nw = 3, verbose = FALSE)

z <- merge(x, y)
x$i.num
y$i.num
z$i.num

Run the code above in your browser using DataLab