View source: R/goodness_of_fit.R
simulate_slopes_for_GOF | R Documentation |
This function creates the data required to apply a goodness of fit test (see
goodness_of_fit
). It it the function of this package that is the most computationally
demanding. Depending on the number of cores CPU you use, the function call may lead to many days
of computation time or a large memory requirement.
simulate_slopes_for_GOF(
N_replicates_level1 = 200L,
N_replicates_level2 = 49L,
birth_level_data,
scenario,
life_history_fits = NULL,
nb_cores = 2L,
lapply_pkg = "pbmcapply",
seed = 1L,
timeout = Inf,
verbose = list(fit = FALSE, simu = FALSE),
.log = FALSE
)
N_replicates_level1 |
the number of simulation replicates to run at the first level (see
|
N_replicates_level2 |
the number of simulation replicates to run at the second level (see
|
birth_level_data |
a |
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 |
nb_cores |
the number of CPU core(s) to use |
lapply_pkg |
the R package used to implement a |
seed |
a seed for the random number generator that will be added to the seeds for individual simulations; with such seeds corresponding to |
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 |
.log |
a boolean indicating whether or not to write progress in a log file (for debugging purposes) |
The function performs the double bootstrapping procedure and proceeds as follow:
if life_history_fits
is not provided, the function starts by fitting the life history
models (see fit_life_histories
) on the input data (i.e. birth_level_data
which unless
studying the robustness of the function, should be the observed data).
the function then run a first series of simulation using the models fitted in step 1 (or the
set provided as an input using the argument life_history_fits
) by calling simulate_slopes
N_replicates_level1
times.
on each simulation outcome, a new set of life history models is fitted (using again
fit_life_histories
). This is the step that is computationally intensive.
the function then run a second series of simulation using the models fitted during step 3 by
calling simulate_slopes
N_replicates_level2
times.
For details on the implementation used for the parallel computing and its settings, see
test_parallel_computation
.
a tibble containing all the results
simulate_slopes
, goodness_of_fit
, test_parallel_computation
#See ?twinR
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.