Exemple #1
0
def test_binomial_vs_poisson(R0, I):
    R0 = torch.tensor(R0)
    I = torch.tensor(I)

    d1 = infection_dist(individual_rate=R0, num_infectious=I)
    d2 = infection_dist(individual_rate=R0, num_infectious=I,
                        num_susceptible=1000., population=1000.)

    assert isinstance(d1, dist.Poisson)
    assert isinstance(d2, dist.Binomial)
    assert_dist_close(d1, d2)
Exemple #2
0
def test_beta_binomial_vs_negative_binomial(R0, I, k):
    R0 = torch.tensor(R0)
    I = torch.tensor(I)

    d1 = infection_dist(individual_rate=R0, num_infectious=I, concentration=k)
    d2 = infection_dist(individual_rate=R0, num_infectious=I, concentration=k,
                        num_susceptible=1000., population=1000.)

    assert isinstance(d1, dist.NegativeBinomial)
    assert isinstance(d2, dist.BetaBinomial)
    assert_dist_close(d1, d2)
Exemple #3
0
def test_negative_binomial_vs_poisson(R0, I):
    R0 = torch.tensor(R0)
    I = torch.tensor(I)

    d1 = infection_dist(individual_rate=R0, num_infectious=I)
    d2 = infection_dist(individual_rate=R0, num_infectious=I,
                        concentration=200.)

    assert isinstance(d1, dist.Poisson)
    assert isinstance(d2, dist.NegativeBinomial)
    assert_dist_close(d1, d2)
Exemple #4
0
def test_beta_binomial_vs_binomial(R0, I):
    R0 = torch.tensor(R0)
    I = torch.tensor(I)

    d1 = infection_dist(individual_rate=R0, num_infectious=I,
                        num_susceptible=20., population=30.)
    d2 = infection_dist(individual_rate=R0, num_infectious=I,
                        num_susceptible=20., population=30.,
                        concentration=200.)

    assert isinstance(d1, dist.Binomial)
    assert isinstance(d2, dist.BetaBinomial)
    assert_dist_close(d1, d2)