qis.generate_bootstrapped_indices

qis.generate_bootstrapped_indices(num_data_index, bootstrap_type=BootstrapType.IID, num_samples=10, index_length=1000, block_size=30, min_block_size=1, seed=1)[source]

draw resampling indices, without touching any data.

This is the primitive behind every bootstrap_* function, and it is public because the indices are what makes paired resampling possible: draw once, then apply the same index array to several aligned panels so their joint structure survives the resample. Pass the result as bootstrapped_indices to bootstrap_data() and friends.

Parameters:
  • num_data_index (int) – number of observations in the source data

  • bootstrap_type (BootstrapType) – resampling scheme; see BootstrapType

  • num_samples (int) – number of independent bootstrap draws, the columns of the result

  • index_length (int) – length of each draw, the rows of the result. May differ from num_data_index

  • block_size (int) – mean block length for STATIONARY, exact block length for FIXED_BLOCK, ignored for IID

  • min_block_size (int) – floor on the drawn block length under STATIONARY. Set it to the number of periods in the slowest-reporting series when the panel mixes frequencies

  • seed (int) – seed for the numba random state

Returns:

integer indices, shape (index_length, num_samples), with every requested position populated from [0, num_data_index); dependence between positions follows bootstrap_type

Raises:

ValueError – if bootstrap_type is not one of the implemented schemes

Return type:

ndarray