示例#1
0
def test_empirical_pdf(smi, u, log):
    cop = EmpiricalCopula(4, smi, smoothing="beta")
    pdf = cop.pdf(u, log) if log else np.log(cop.pdf(u))

    expected = [-38.968738, -7.304777, -14.892165, -5.423080, -24.478464]

    assert_almost_equal(pdf, expected, decimal=6)
示例#2
0
def test_empirical_to_margins():
    data = load_marginal_data()
    cop = EmpiricalCopula(data)

    test_input = pseudo_obs(data)[:6]
    output = cop.to_marginals(test_input)

    assert_almost_equal(output, data.iloc[:6].to_numpy())
示例#3
0
def copula():
    data = load_marginal_data()
    return EmpiricalCopula(data)
示例#4
0
def test_empirical_summary(smi):
    cop = EmpiricalCopula(data=smi)
    assert isinstance(cop.summary(), Summary)
示例#5
0
def test_empirical_random(smi, seed):
    cop = EmpiricalCopula(data=smi)
    rvs = cop.random(5, seed)

    assert rvs.shape == (5, smi.shape[1])
示例#6
0
def test_empirical_param_returns_none(smi):
    cop = EmpiricalCopula(data=smi)
    assert cop.params is None
示例#7
0
def test_empirical_cdf(u, smi, smoothing, expected):
    cop = EmpiricalCopula(data=smi, smoothing=smoothing)
    assert_almost_equal(cop.cdf(u), expected)
示例#8
0
def test_empirical_non_applicable_methods_raises_error(smi, func):
    cop = EmpiricalCopula(data=smi)
    with pytest.raises(NotApplicableError):
        eval(func)