def test_monotonicity_rates_v2(): _, P1 = computeBayesTest([0.9, 0.1], 1000) _, P2 = computeBayesTest([0.2, 0.1], 1000) assert P1.loc["A", "B"] >= P2.loc["A", "B"]
def test_monotonicity_confidence(): C1, _ = computeBayesTest([0.2, 0.1], 1000, credible_interval_prob=80.) C2, _ = computeBayesTest([0.2, 0.1], 1000, credible_interval_prob=90.) assert C2.loc["A", "B"][1] - C2.loc["A", "B"][0] >= C1.loc[ "A", "B"][1] - C1.loc["A", "B"][0]
def test_monotonicity_rates_v1(): _, P = computeBayesTest([0.2, 0.1], 1000) assert P.loc["A", "B"] > 0.5
def empiricalRateSuccess(n, p1, p2, n_mc): rate_list = np.random.binomial(n / 2., p2, n_mc) / (n / 2.) pval_list = [np.nan for i in rate_list] for count, rate in enumerate(rate_list): pval_list[count] = computeBayesTest([p1, rate], n)[1].loc["B", "A"] return (np.mean(np.array(pval_list) > 0.8))