
Prepare bootstrap and confidence interval parameters for an indicator
Source:R/prepare_indicator_bootstrap.R
prepare_indicator_bootstrap.RdThis function prepares the argument lists for dubicube::bootstrap_cube()
and dubicube::calculate_bootstrap_ci() based on the indicator definition.
Behaviour (grouping, bootstrap method, transformations, bias correction)
is fully controlled by a rule book keyed on indicator$div_type.
Arguments
- indicator
A list describing the indicator. Must contain at least
div_typeandraw_data.- num_bootstrap
Integer. Number of bootstrap samples.
- ci_type
Character. Type of confidence interval.
- seed
Optional integer. Random seed for bootstrapping. (Default: 123)
- trans
Optional transformation function applied to the statistic. Will be overridden if specified by the indicator rule book.
- inv_trans
Optional inverse transformation function. Will be overridden if specified by the indicator rule book.
- confidence_level
Numeric between 0 and 1. Confidence level.
- expected_years
(Optional) Vector of years expected in the output. Used to ensure consistent data frame structure during bootstrapping.
- boot_args
Named list of additional arguments passed to
bootstrap_cube(), overriding defaults.- ci_args
Named list of additional arguments passed to
calculate_bootstrap_ci(), overriding defaults.
Value
A named list with two elements:
- bootstrap_params
List of parameters for
bootstrap_cube()- ci_params
List of parameters for
calculate_bootstrap_ci()
Examples
# \donttest{
ind <- total_occ_ts(example_cube_1, first_year = 2000)
params <- prepare_indicator_bootstrap(
indicator = ind,
num_bootstrap = 100,
ci_type = "perc"
)
names(params$bootstrap_params)
#> [1] "data_cube" "fun" "grouping_var" "samples"
#> [5] "processed_cube" "method" "seed" "expected_years"
# }