Beispiel #1
0
def get_chu_stinchcombe_white_statistics(series: pd.Series,
                                         test_type: str = 'one_sided',
                                         num_threads: int = 8,
                                         verbose: bool = True) -> pd.Series:
    """
    Multithread Chu-Stinchcombe-White test implementation, p.251

    :param series: (pd.Series) Series to get statistics for
    :param test_type: (str): Two-sided or one-sided test
    :param num_threads: (int) Number of cores
    :param verbose: (bool) Flag to report progress on asynch jobs
    :return: (pd.Series) Statistics
    """
    molecule = series.index[
        2:
        series.shape[0]]  # For the first two values we don't have enough info

    s_n_t_series = mp_pandas_obj(
        func=_get_s_n_for_t,
        pd_obj=('molecule', molecule),
        series=series,
        test_type=test_type,
        num_threads=num_threads,
        verbose=verbose,
    )
    return s_n_t_series
Beispiel #2
0
def get_chow_type_stat(series: pd.Series,
                       min_length: int = 20,
                       num_threads: int = 8) -> pd.Series:
    """
    Multithread implementation of Chow-Type Dickey-Fuller Test, p.251-252

    :param series: (pd.Series) Series to test
    :param min_length: (int) Minimum sample length used to estimate statistics
    :param num_threads: (int): Number of cores to use
    :return: (pd.Series) Chow-Type Dickey-Fuller Test statistics
    """
    # Indices to test. We drop min_length first and last values
    molecule = series.index[min_length:series.shape[0] - min_length]
    dfc_series = mp_pandas_obj(
        func=_get_dfc_for_t,
        pd_obj=('molecule', molecule),
        series=series,
        num_threads=num_threads,
    )
    return dfc_series