← Back to Cashflow Modelling in Python

Actuarial Present Value

Fantastic work on the survival rate and expected benefit! There is one more step before us... In this lesson we will get to the most important part - actuarial present value!

Actuarial Present Value

Calculate the actuarial present value (APV) which is the sum of discounted expected benefits.

Use a recursive approach:

\( \text{APV(t)} = \text{expected_benefit(t)} + \text{APV(t+1)} \cdot v \)

where:

  • \( v = \frac{1}{1+i} \),
  • \( i \) is the monthly interest rate (interest_rate),

Remember that for the last month (maximum t), the actuarial present value equals the expected benefit.

Fill in the code:

# model.py

from settings import settings

@variable()
def actuarial_present_value(t):
    if t == settings["_____"]:
        return _____
    else:
        v = 1 / (1 + _____)
        return _____ + v * _____

Task:

  • Use the T_MAX_CALCULATION setting from settings.py,
  • Fill in the following variables: expected_benefit(t), interest_rate, actuarial_present_value(t+1).

Individual results

By default, the results are presented in the aggregated way. However, for various reasons - such as debugging - you might want to see the results for each insured person separately.

To get results for each insured person separately, set in settings.py:

# settings.py

settings = {
    "GROUP_BY": "id",
}

Task: Change the settings to get results for each insured person separately.

  Next