def test_unequal_bs(): def mean_diff(*args): return args[0].mean() - args[1].mean() rs = RandomState(0) x = rs.randn(800) y = rs.randn(200) bs = IndependentSamplesBootstrap(x, y, random_state=rs) variance = bs.var(mean_diff) assert variance > 0 ci = bs.conf_int(mean_diff) assert ci[0] < ci[1] applied = bs.apply(mean_diff, 1000) assert len(applied) == 1000 x = pd.Series(x) y = pd.Series(y) bs = IndependentSamplesBootstrap(x, y) variance = bs.var(mean_diff) assert variance > 0
def test_unequal_bs_kwargs(): def mean_diff(x, y): return x.mean() - y.mean() rs = RandomState(0) x = rs.standard_normal(800) y = rs.standard_normal(200) bs = IndependentSamplesBootstrap(x=x, y=y, random_state=rs) variance = bs.var(mean_diff) assert variance > 0 ci = bs.conf_int(mean_diff) assert ci[0] < ci[1] applied = bs.apply(mean_diff, 1000) x = pd.Series(x) y = pd.Series(y) bs = IndependentSamplesBootstrap(x=x, y=y, random_state=rs) variance = bs.var(mean_diff) assert variance > 0 assert len(applied) == 1000
def test_unequal_bs(): def mean_diff(*args): return args[0].mean() - args[1].mean() rs = RandomState(0) x = rs.standard_normal(800) y = rs.standard_normal(200) bs = IndependentSamplesBootstrap(x, y, random_state=rs) variance = bs.var(mean_diff) assert variance > 0 ci = bs.conf_int(mean_diff) assert ci[0] < ci[1] applied = bs.apply(mean_diff, 1000) assert len(applied) == 1000 x = pd.Series(x) y = pd.Series(y) bs = IndependentSamplesBootstrap(x, y) variance = bs.var(mean_diff) assert variance > 0 with pytest.raises(ValueError, match="BCa cannot be applied"): bs.conf_int(mean_diff, method="bca")