metacast.sensitivity_analyses.asses_lh_sample_size

Creation:

Author: Martin Grunnill Date: 2022-10-05

Description: Assess if a Latin-Hypercube sample size is reasonable.

Module Contents

Functions

determine_lh_sample_size(parameters_df, ...[, ...])

Assess if a Latin-Hypercube (LH) sample size is reasonable.

metacast.sensitivity_analyses.asses_lh_sample_size.determine_lh_sample_size(parameters_df, model_run_method, start_n, repeats_per_n, std_aim, LHS_PRCC_method, save_dir, attempts_to_make=float('inf'), n_increase_addition=None, n_increase_multiple=None, y0=None, other_samples_to_repeat=None, max_workers=None)

Assess if a Latin-Hypercube (LH) sample size is reasonable.

Method is as follows:
  1. For a given LH sample size draw and simulate a model through repeats_per_n number of LHSs.

  2. Determine standard deviation in PRCCs. If any PRCC is greater than std_aim increase LH sample size by either addittion (n_increase_addition) or multiplication (n_increase_multiple) and return to 1.

Parameters:
  • parameters_df (pd.DataFrame) – DataFrame outlining the boundaries for each parameter. Must contain fields ‘Lower Bound’ and ‘Upper Bound’. Name of the parameters is assumed to be in the index.

  • model_run_method (function) – Method for simulating model.

  • start_n (int) – Suggested sample size to start from.

  • repeats_per_n (int) – Number of repeats per sample size.

  • std_aim (float) – Standard deviation goal.

  • LHS_PRCC_method (function) – Method for drawing LHs simulating models through LHs and determining PRCC.

  • save_dir (string) – Directory for saving results.

  • attempts_to_make (int) – Number of attempts to make.

  • n_increase_addition (int, mutually exclusive with n_increase_multiple) – Increase in sample size, by addition, to be made if standard deviation in any paramters PRCC is greater than std_aim.

  • n_increase_multiple (int, mutually exclusive with n_increase_addition) – Increase in sample size, by multiplication, to be made if standard deviation in any paramters PRCC is greater than std_aim.

  • y0 (numpy.array, optional) – Intial values of state variables.

  • other_samples_to_repeat (pandas.DataFrame) – Samples to resampled and merged with LH samples.

  • max_workers (int, optional) – Number workers if LHS_PRCC method is parallelized.

Returns:

Sample size assessed as being reasonable.

Return type:

int