Learn R Programming

fb4package (version 2.0.0)

bootstrap_single_iteration: Execute a single bootstrap iteration

Description

Internal helper: resamples weights, finds the p_value that achieves the resampled mean weight via optim_search_p_value, then extracts consumption and (optionally) the predicted final weight.

Extracted to eliminate code duplication between the sequential and parallel execution paths of bootstrap_p_values.

Usage

bootstrap_single_iteration(
  final_weights,
  n_sample,
  simulation_function,
  processed_simulation_data,
  oxycal,
  store_predicted_weights,
  upper_p = 1
)

Value

Named list with fields p_estimate, consumption_estimate,

predicted_weight, mean_fin, and success (logical).

Arguments

final_weights

Observed final weights vector

n_sample

Sample size for bootstrap resampling

simulation_function

Closure accepting a p_value and returning the predicted final weight; used by optim_search_p_value

processed_simulation_data

Processed simulation data list

oxycal

Oxycalorific coefficient (J/g O2)

store_predicted_weights

Logical; retrieve the predicted final weight?

upper_p

Upper bound for p_value search, default 5.0