| update.micsim_model | R Documentation |
Returns a model with a different starting population, immigrant
population, or both. All other settings are retained, and the new
populations are checked exactly as micsim_model() checks them.
This allows a model developed on a sample to be applied to the full population without repeating the model specification.
## S3 method for class 'micsim_model'
update(object, population, immigrants, ...)
object |
A |
population |
A new starting population, in the format
|
immigrants |
A new immigrant table, or |
... |
Must be empty. |
Only population and immigrants can be changed with this method.
To change the state space, transitions, simulation period, maximum age,
exit types or subsystems, rebuild the model with micsim_model() and,
where needed, add_subsystem().
Replace populations through update() so that the model is checked.
Direct assignment, such as model$population <- ..., bypasses these
checks and is not supported.
A micsim_model.
micsim_model(), add_subsystem()
mort <- function(age, calTime) 0.0001 * exp(0.085 * age)
pop <- data.frame(ID = 1:200, birthDate = "19700101",
initState = rep(c("m", "f"), 100))
sample_model <- micsim_model(state_space(sex = c("m", "f")),
transitions(transition(NA, "dead", mort)),
pop[1:20, ], c(20000101, 20101231))
full_model <- update(sample_model, population = pop)
nrow(full_model$population)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.