コード例 #1
0
def test_negative_binomial_model_update():
    model = NegativeBinomialModel(r=10, alpha=1, beta=1)
    data = np.array([26, 31, 36, 35, 24, 44, 25, 40, 55, 24])

    model.update(data)

    assert model.n_samples_ == 10
コード例 #2
0
def test_negative_binomial_mv_check_model_input():
    modelA = NegativeBinomialModel(r=10, alpha=1, beta=1)
    modelB = NegativeBinomialModel(r=10, alpha=1, beta=1)

    with raises(TypeError):
        NegativeBinomialMVTest(models=[modelA, modelB])
コード例 #3
0
def test_negative_binomial_ab_check_model():
    modelA = NegativeBinomialModel(r=10, alpha=1, beta=1)
    modelB = BinomialModel(m=10, alpha=1, beta=1)

    with raises(TypeError):
        NegativeBinomialABTest(modelA=modelA, modelB=modelB)
コード例 #4
0
def test_negative_binomial_model_mean_var():
    model = NegativeBinomialModel(r=10, alpha=1, beta=6)

    assert np.isnan(model.ppmean())
    assert np.isnan(model.ppvar())
コード例 #5
0
def test_negative_binomial_model_stats():
    model = NegativeBinomialModel(r=10, alpha=4, beta=6)

    assert model.ppmean() == approx(20)
    assert model.ppvar() == approx(390)
コード例 #6
0
def test_negative_binomial_model_pppdf_x():
    model = NegativeBinomialModel(r=10, alpha=4, beta=6)

    assert model.pppdf([-1, 0, 10, 20]) == approx(
        [0, 0.0030959752, 0.0428785607, 0.0239013606])
コード例 #7
0
def test_negative_binomial_r():
    with raises(ValueError):
        NegativeBinomialModel(r=0, alpha=1, beta=1)