Ejemplo n.º 1
0
def test_pareto_numeric():
    xm, beta = Integer(3), Integer(2)
    alpha = beta + 5
    X = Pareto('x', xm, alpha)

    assert E(X) == alpha*xm/(alpha - 1)
    assert variance(X) == xm**2*alpha/(((alpha - 1)**2*(alpha - 2)))
Ejemplo n.º 2
0
def test_pareto():
    xm, beta = symbols('xm beta', positive=True, finite=True)
    alpha = beta + 5
    X = Pareto('x', xm, alpha)

    dens = density(X)
    x = Symbol('x')
    assert dens(x) == x**(-(alpha + 1))*alpha*xm**alpha
Ejemplo n.º 3
0
def test_prefab_sampling():
    N = Normal('X', 0, 1)
    L = LogNormal('L', 0, 1)
    E = Exponential('Ex', 1)
    P = Pareto('P', 1, 3)
    W = Weibull('W', 1, 1)
    U = Uniform('U', 0, 1)
    B = Beta('B', 2, 5)
    G = Gamma('G', 1, 3)

    variables = [N, L, E, P, W, U, B, G]
    niter = 10
    for var in variables:
        for i in range(niter):
            assert sample(var) in var.pspace.domain.set