Chargement du reste de cette comparaison.

CashValue_ME_EX1 vs CashValue_ME_EX4

Créé Le diff n'expire jamais
6 suppressions
1038 lignes
12 ajouts
1035 lignes
def age(t):
def age(t):
"""The attained age at time t.
"""The attained age at time t.


Defined as::
Defined as::


age_at_entry() + duration(t)
age_at_entry() + duration(t)


.. seealso::
.. seealso::


* :func:`age_at_entry`
* :func:`age_at_entry`
* :func:`duration`
* :func:`duration`


"""
"""
return age_at_entry() + duration(t)
return age_at_entry() + duration(t)




def age_at_entry():
def age_at_entry():
"""The age at entry of the model points
"""The age at entry of the model points


The ``age_at_entry`` column of the DataFrame returned by
The ``age_at_entry`` column of the DataFrame returned by
:func:`model_point`.
:func:`model_point`.
"""
"""
return model_point()["age_at_entry"]
return model_point()["age_at_entry"].values




def av_at(t, timing):
def av_at(t, timing):
"""Account value in-force
"""Account value in-force


:func:`av_at(t, timing)<av_at>` calculates
:func:`av_at(t, timing)<av_at>` calculates
the total amount of account value at time ``t`` for the policies represented
the total amount of account value at time ``t`` for the policies represented
by a model point.
by a model point.


At each ``t``, the events that change the account value balance
At each ``t``, the events that change the account value balance
occur in the following order:
occur in the following order:


* Maturity
* Maturity
* New business and premium payment
* New business and premium payment
* Fee deduction
* Fee deduction


The second parameter ``timing`` takes a string to
The second parameter ``timing`` takes a string to
indicate the timing of the account value, which is either
indicate the timing of the account value, which is either
``"BEF_MAT"``, ``"BEF_NB"`` or ``"BEF_FEE"``.
``"BEF_MAT"``, ``"BEF_NB"`` or ``"BEF_FEE"``.




.. rubric:: BEF_MAT
.. rubric:: BEF_MAT


The amount of account value before maturity, defined as::
The amount of account value before maturity, defined as::


av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_MAT")
av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_MAT")


.. rubric:: BEF_NB
.. rubric:: BEF_NB


The amount of account value before new business after maturity,
The amount of account value before new business after maturity,
defined as::
defined as::


av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_NB")
av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_NB")


.. rubric:: BEF_FEE
.. rubric:: BEF_FEE


The amount of account value before lapse and death after new business,
The amount of account value before lapse and death after new business,
defined as::
defined as::


av_pp_at(t, "BEF_FEE") * pols_if_at(t, "BEF_DECR")
av_pp_at(t, "BEF_FEE") * pols_if_at(t, "BEF_DECR")




.. seealso::
.. seealso::
* :func:`pols_if_at`
* :func:`pols_if_at`
* :func:`av_pp_at`
* :func:`av_pp_at`




"""
"""
if timing == "BEF_MAT":
if timing == "BEF_MAT":
return av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_MAT")
return av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_MAT")


elif timing == "BEF_NB":
elif timing == "BEF_NB":
return av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_NB")
return av_pp_at(t, "BEF_PREM") * pols_if_at(t, "BEF_NB")


elif timing == "BEF_FEE":
elif timing == "BEF_FEE":
return av_pp_at(t, "BEF_FEE") * pols_if_at(t, "BEF_DECR")
return av_pp_at(t, "BEF_FEE") * pols_if_at(t, "BEF_DECR")


else:
else:
raise ValueError("invalid timing")
raise ValueError("invalid timing")




def av_change(t):
def av_change(t):
"""Change in account value
"""Change in account value


Change in account value during each period, defined as::
Change in account value during each period, defined as::


av_at(t+1, 'BEF_MAT') - av_at(t, 'BEF_MAT')
av_at(t+1, 'BEF_MAT') - av_at(t, 'BEF_MAT')


.. seealso::
.. seealso::


* :func:`net_cf`
* :func:`net_cf`


"""
"""
return av_at(t+1, 'BEF_MAT') - av_at(t, 'BEF_MAT')
return av_at(t+1, 'BEF_MAT') - av_at(t, 'BEF_MAT')




def av_pp_at(t, timing):
def av_pp_at(t, timing):