Exemplo n.º 1
0
def test_nEx_g_2():
    i = 2
    g = 1
    x = 45
    defer = 5
    method = 'udd'
    cf_grf95 = commutation_table.CommutationFunctions(i=i, g=g, mt=soa_GRF95.table_qx)
    cf_tv7377 = commutation_table.CommutationFunctions(i=i, g=g, mt=soa_TV7377.table_qx)

    a_grf = annuities.nEx(mt=mt_GRF95, x=x, i=i, g=g * 0, defer=defer, method=method)
    a_tv = annuities.nEx(mt=mt_TV7377, x=x, i=i, g=g * 0, defer=defer, method=method)
    a_grf_2 = cf_grf95.nEx(x=x, n=defer)
    cf_tv_2 = cf_tv7377.nEx(x=x, n=defer)

    assert a_grf == pytest.approx(a_grf_2, rel=1e-16)
    assert a_tv == pytest.approx(cf_tv_2, rel=1e-16)
Exemplo n.º 2
0
def nAEx_(mt, x, n, i=None, g=.0, method='udd'):
    """
    Endowment insurance
    :param mt: table for life x
    :param x: age at the beginning of the contract
    :param n: period of the contract
    :param i: technical interest rate (flat rate) in percentage, e.g., 2 for 2%
    :param g: growth rate (flat rate) in percentage, e.g., 2 for 2%
    :param method: the method to approximate the fractional periods
    :return: Expected Present Value (EPV) of an Endowment life insurance (i.e. net single premium), that
    pays 1, at the moment of death or 1 if x survives to age x+n. It is also commonly referred to as the
    Actuarial Value or Actuarial Present Value.
    """
    return nAx_(mt=mt, x=x, n=n, i=i, g=g, method=method) + annuities.nEx(mt=mt, x=x, i=i, g=g, defer=n, method=method)
Exemplo n.º 3
0
def nIAEx_(mt, x, n, i=None, inc=1, method='udd'):
    """
    Endowment insurance
    :param mt: table for life x
    :param x: age at the beginning of the contract
    :param n: period of the contract
    :param i: technical interest rate (flat rate) in percentage, e.g., 2 for 2%
    :param inc: linear increment in monetary units, e.g., 1 for one monetary unit
    :param method: the method to approximate the fractional periods
    :return: Expected Present Value (EPV) of an Endowment life insurance (i.e. net single premium), that pays 1+m,
    at the moment of death, if death happens between age x+m and x+m+1, or 1 if x survives to age x+n.
     It is also commonly referred to as the Actuarial Value or Actuarial Present Value.
    """
    return nIAx(mt=mt, x=x, n=n, i=i, inc=inc, method=method) * np.sqrt(1 + i / 100) + \
           annuities.nEx(mt=mt, x=x, i=i, g=0, defer=n, method=method)
Exemplo n.º 4
0
def t_nIAEx(mt, x, n, defer=0, i=None, inc=1., method='udd'):
    """
    Deferred Endowment insurance
    :param mt: table for life x
    :param x: age at the beginning of the contract
    :param n: period of the contract
    :param defer: deferment period
    :param i: technical interest rate (flat rate) in percentage, e.g., 2 for 2%
    :param inc: linear increment in monetary units, e.g., 1 for one monetary unit
    :param method: the method to approximate the fractional periods
    :return: Expected Present Value (EPV) of a whole life insurance (i.e. net single premium), that pays 1+m, at the
    end of the year of death, if death happens between age x+m and x+m+1 or 1 if x survives to age x+n+defer.
    It is also commonly referred to as the Actuarial Value or Actuarial Present Value.
    """
    return IA_x(mt=mt, x=x, x_first=x + 1 + defer, x_last=x + n + defer, i=i, inc=inc, method=method) + \
           annuities.nEx(mt=mt, x=x, i=i, g=0, defer=n + defer, method=method)