def test_expanding_consistency_std(consistency_data, min_periods):
    x, is_constant, no_nans = consistency_data
    moments_consistency_std_data(
        x=x,
        var_unbiased=lambda x: x.expanding(min_periods=min_periods).var(),
        std_unbiased=lambda x: x.expanding(min_periods=min_periods).std(),
        var_biased=lambda x: x.expanding(min_periods=min_periods).var(ddof=0),
        std_biased=lambda x: x.expanding(min_periods=min_periods).std(ddof=0),
    )
示例#2
0
def test_rolling_consistency_std(consistency_data, window, min_periods,
                                 center):
    x, is_constant, no_nans = consistency_data
    moments_consistency_std_data(
        x=x,
        var_unbiased=lambda x: (x.rolling(
            window=window, min_periods=min_periods, center=center).var()),
        std_unbiased=lambda x: (x.rolling(
            window=window, min_periods=min_periods, center=center).std()),
        var_biased=lambda x:
        (x.rolling(window=window, min_periods=min_periods, center=center).var(
            ddof=0)),
        std_biased=lambda x:
        (x.rolling(window=window, min_periods=min_periods, center=center).std(
            ddof=0)),
    )
def test_ewm_consistency_std(consistency_data, min_periods, adjust, ignore_na):
    x, is_constant, no_nans = consistency_data
    com = 3.0
    moments_consistency_std_data(
        x=x,
        var_unbiased=lambda x: (x.ewm(com=com,
                                      min_periods=min_periods,
                                      adjust=adjust,
                                      ignore_na=ignore_na).var(bias=False)),
        std_unbiased=lambda x: (x.ewm(com=com,
                                      min_periods=min_periods,
                                      adjust=adjust,
                                      ignore_na=ignore_na).std(bias=False)),
        var_biased=lambda x: (x.ewm(com=com,
                                    min_periods=min_periods,
                                    adjust=adjust,
                                    ignore_na=ignore_na).var(bias=True)),
        std_biased=lambda x: x.ewm(com=com,
                                   min_periods=min_periods,
                                   adjust=adjust,
                                   ignore_na=ignore_na).std(bias=True),
    )