| transitions | R Documentation |
Collects the individual transition() declarations into one object for
micsim_model(). Each declaration describes an origin, destination and
rate function; the collection describes which moves the model allows.
transitions(...)
... |
Objects from |
Order matters only for readability. Each destination receives its random numbers in the order of the state space, so declaring the same transitions in a different order gives the same population under the same seed.
An object of class micsim_transitions.
transition(), micsim_model()
# Set the rates for the allowed transitions
first_birth <- function(age) ifelse(age >= 18 & age < 45, 0.10, 0)
second_birth <- function(age) ifelse(age >= 18 & age < 45, 0.08, 0)
mortality <- function(age) 0.00003 * exp(0.1 * age)
# Collect all the allowed transitions in one object
trans <- transitions(
transition(move("parity", from = "0", to = "1", where = sex == "female"),
rate = first_birth),
transition(move("parity", from = "1", to = "2", where = sex == "female"),
rate = second_birth),
transition(from = NA, to = "deceased", rate = mortality)
)
trans
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.