simulate_reproduction: Simulate data to study the reproductive life of mothers

View source: R/simulations.R

simulate_reproductionR Documentation

Simulate data to study the reproductive life of mothers

Description

This function simulates the life history of mothers and extract information about simulated individuals. The argument effect_pt can be used to simulate an increased (or reduced) twinning propensity.

Usage

simulate_reproduction(
  birth_level_data,
  scenario,
  life_history_fits = NULL,
  effect_pt = 0,
  N_replicates = 100L,
  seed = 1L,
  nb_cores = 2L,
  lapply_pkg = "pbmcapply"
)

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

effect_pt

a numerical value defining by how much the intercept of fit_pt has to be increased (on the scale of the linear predictor)

N_replicates

the number of simulation replicates to run

seed

an integer providing the seed for the random generator

nb_cores

the number of CPU core(s) to use

lapply_pkg

the R package used to implement a lapply() kind of function (default = "pbmcapply"; other possibilities are "parallel" and "base")

Value

a tibble containing information about the reproductive life of the simulated mothers

Examples

## See ?twinR


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