| truncate_sim | R Documentation |
Left-truncates simulation epidemiological summary statistics and network statistics at a specified time step.
truncate_sim(x, at, reset.time)
## S3 method for class 'dcm'
truncate_sim(x, at, reset.time = TRUE)
## S3 method for class 'icm'
truncate_sim(x, at, reset.time = TRUE)
## S3 method for class 'netsim'
truncate_sim(x, at, reset.time = TRUE)
x |
Object of class |
at |
Time step at which to left-truncate the time series. |
reset.time |
If |
This function would be used when running a follow-up simulation from time
steps b to c after a burn-in period from time a to
b, where the final time window of interest for data analysis is
b to c only.
The updated object of class dcm, netsim, or icm.
# DCM examples
param <- param.dcm(inf.prob = 0.2, act.rate = 0.25)
init <- init.dcm(s.num = 500, i.num = 1)
control <- control.dcm(type = "SI", nsteps = 200)
mod1 <- dcm(param, init, control)
plot(mod1)
# Reset time
mod2a <- truncate_sim(mod1, at = 150)
plot(mod2a)
head(as.data.frame(mod2a))
# Do not reset time
mod2b <- truncate_sim(mod1, at = 150, reset.time = FALSE)
plot(mod2b)
head(as.data.frame(mod2b))
# ICM example
param <- param.icm(inf.prob = 0.2, act.rate = 0.25)
init <- init.icm(s.num = 500, i.num = 1)
control <- control.icm(type = "SI", nsteps = 200, nsims = 1)
mod1 <- icm(param, init, control)
# Reset time
mod2a <- truncate_sim(mod1, at = 150)
plot(mod2a)
head(as.data.frame(mod2a))
# Do not reset time
mod2b <- truncate_sim(mod1, at = 150, reset.time = FALSE)
plot(mod2b)
head(as.data.frame(mod2b))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.