popsim | R Documentation |
This function simulates the random evolution of an IBM.
popsim(
model,
initial_population,
events_bounds,
parameters = NULL,
age_max = Inf,
time,
multithreading = FALSE,
num_threads = NULL,
clean_step = NULL,
clean_ratio = 0.1,
seed = NULL,
verbose = FALSE
)
model |
Model resulting from a call to the function |
initial_population |
Object of population class representing the initial population. |
events_bounds |
Named vector of events bounds, with names corresponding to events names. |
parameters |
List of model parameters. |
age_max |
Maximum age of individuals in the population ( |
time |
Final time (Numeric). Can be of length 1 or a vector of simulation discretized times. |
multithreading |
Logical for multithread activation, |
num_threads |
(Optional) Number of threads used for multithreading. Set by default to the number of concurrent threads supported by the available hardware implementation. |
clean_step |
(Optional) Optional parameter for improving simulation time. Time step for removing dead (or exited) individuals from the population. By default, equal to age_max. |
clean_ratio |
(Optional) Optional parameter for improving simulation time. 0.1 by default. |
seed |
(Optional) Random generator seed, random by default. |
verbose |
(Optional) Activate verbose output, FALSE by default. |
List composed of
Simulation inputs (initial population, parameters value, multithreading...)
Simulation logs (algorithm duration, accepted/rejected events...).
If time
is of length 1, population is an object of type population containing of all individuals who lived in the population in the time interval [0,time]
. If time
is a vector (time[1], ..., time[n]
), population
is a list of n
objects of type population, each representing the state of the population at time time[i]
, for i = 1,..., n
.
mk_model
.
init_size <- 100000
pop_df <- data.frame(birth = rep(0, init_size), death = NA)
pop <- population(pop_df)
birth = mk_event_poisson(type = 'birth', intensity = 'lambda')
death = mk_event_poisson(type = 'death', intensity = 'mu')
params = list('lambda' = 100, 'mu' = 100)
birth_death <- mk_model(events = list(birth, death),
parameters = params)
sim_out <- popsim(model = birth_death,
initial_population = pop,
events_bounds = c('birth' = params$lambda, 'death' = params$mu),
parameters = params,
time = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.