pyredraw.ts
Module Contents
Functions
|
Select sample of blocks from input time series array via moving block bootstrap. |
|
Create replicates of time series array via moving block bootstrap. |
- pyredraw.ts.moving_block_selection(data_array, block_window_length)[source]
- Select sample of blocks from input time series array via moving block bootstrap.
Result is a single replicate of the input array.
- Parameters
data_array (numpy ndarray (1D)) – Time series data on which user would like perform moving block bootstrap.
block_window_length (int) – Number of data points in a block bootstrap sample. Length of block sample. If input is float, will be converted to integer.
- Returns
Moving block boostrap result from input data_array. Result is same size as input data given by data_array and is a single boostrap replicate of the input data_array.
- Return type
numpy ndarray (1D)
Examples
>>> data_array = [1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] >>> block_window_length = 3 >>> moving_block_selection(data_array, block_window_length)
References
Bergmeir C., Hyndman R.J., Benitez J.M.: Bagging exponential smoothing methods using STL decomposition and Box-cox Transformation. International Journal of Forecasting, 32(2):303-312, (2016)
- pyredraw.ts.moving_block_bootstrap(data_array, block_window_length, number_replicates, seed=1027)[source]
Create replicates of time series array via moving block bootstrap.
- Parameters
data_array (list, pandas Series, numpy ndarray (1D)) – Time series data on which user would like perform moving block bootstrap.
block_window_length (int or float) – Number of data points in a block bootstrap sample. Length of block sample. If input is float, will be converted to integer.
number_replicates (int or float) – Number of bootstrap replicates of input data to create.
seed (int) – Value of random seed for random number generator for reproducibility. Default value of random seed is 1027 which will be used if no value is provided.
- Returns
Moving block boostrap replicates from input data_array. Resulting array has number of columns equal to length of input data and number of rows is equal to number of replicates. Each row is a single bootstrap replicate.
- Return type
numpy ndarray (2D)
Examples
>>> data_array = [1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] >>> block_window_length = 3 >>> number_replicates = 10 >>> moving_block_bootstrap(data_array, block_window_length, number_replicates)