run_simulation: Run a simulation

View source: R/simulations.R

run_simulationR Documentation

Run a simulation

Description

This function runs a single simulation. If the fits of the life history models are not provided, they will be fitted within the function call.

Usage

run_simulation(
  birth_level_data,
  scenario = NULL,
  life_history_fits = NULL,
  seed = 123L,
  output = list(birth_level_data.simulated = FALSE, slope = TRUE, fits = FALSE),
  timeout = Inf,
  verbose = list(fit = FALSE, simu = FALSE)
)

Arguments

birth_level_data

a tibble or data.frame with birth level data (expanded or not)

scenario

the scenario defining which models to be fitted: e.g. "ABCD", "AC"... (see paper for explanations)

life_history_fits

a named list containing the fits of each three life history models

seed

an integer providing the seed for the random generator

output

a named list of booleans with elements birth_level_data.simulated, slope and fit indicating what to output

timeout

the maximal duration (in seconds) allowed for the fitting procedure (default = Inf)

verbose

whether to display the formula of the fit during the fitting procedure

Details

The output is conditional on the input so to save memory footprint and only return whatever is needed for a given application.

Value

a list with the output requested

See Also

simulate_slopes

Examples

# See ?twinR


courtiol/twinR documentation built on July 11, 2024, 12:04 a.m.