Description Usage Arguments Value Examples
Organize population data and transition parameters to run state_trans function over the given number of timesteps.
1 | run_state_trans(timesteps, param, pop, transient = "", useC = TRUE)
|
timesteps |
A numeric scalar based on which the state_trans function will run for that specific no. of |
param |
A list of lists. Each low-level list must contain transition parameters required by the |
pop |
A state matrix created from |
transient |
A character vector. Each element must include formula(e)/expression(s) to evaluate dynamic parameters after each timestep. |
useC |
A logical value, which is TRUE by default, will run |
A summary matrix of the states all individuals in the population are in.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | pop <- syn_pop(c(19,1,0,0,0)) #synthesizing population
b <- 2 #effective contact rate
param <- list(
list(1,c(2,5),c(NA,.1)), #transition from state 1 to 2 using FOI lambda
list(2,3,100), #transition from state 2 to 3,
list(3,4,100) #the 3rd term ensures the transition to the next stage
)
timesteps <- 10
transient <- c("param[[1]][[3]][1] <- rate2prob(b*sum(pop[,2],pop[,3])/sum(pop))")
eval(parse(text=transient))
run_state_trans(timesteps, param, pop, transient)
run_state_trans(timesteps, param, pop, transient, useC = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.