Actuarial cash flow models predict the future. During development, actuaries need to decide on **the projection horizon** of the cash flow model.

In this post, we will discuss how to decide on the horizon and how to set it up in the model's settings.

List of content:

While deciding on the projection horizon, it's worth taking into consideration two aspects:

**precision**- the longer the projection horizon, the higher the precision of the results,**runtime**- the shorter the projection horizon, the faster the model.

Let's see how the maximal calculation period impacts the results. For this post, we will use the cashflower package. In particular, we wil discuss two settings: T_MAX_CALCULATION and T_MAX_OUTPUT.

## Maximal calculation period

The projection horizon is one of the cash flow model's settings. The setting is called T_MAX_CALCULATION and its default value is 720 months (60 years). The value is set in the settings.py script.

settings.py```
settings = {
...
"T_MAX_CALCULATION": 720,
...
}
```

**Should we change maximal calculation period?**

If you are not sure what maximal calculation period to use, it's always better to be on the safe side and set it to a high number. The maximum number that is used in life insurance is usually 1440 (120 years). This is because most of the Statistics Offices publish mortality rates up to 120 years old. After the age of 120, the probability of death is assumed to be 100%.

However, if you know that the insurance product does not last that long, you can decrease it. For example, if the insurance product is sold only to adults or only to pensioners, then the horizon of 120 years is unnecessarily long.

Let's see how it works on a simple example.

In our example, there is a payment of €100 is made each month for a year.

model.py```
@variable()
def payment(t):
if 1 <= t <= 12:
return 100
return 0
```

We want to calculate the total value of future payments.

model.py```
@variable()
def future_payments(t):
if t == settings["T_MAX_CALCULATION"]:
return payment(t)
return payment(t) + future_payments(t+1)
```

The default value of the T_MAX_CALCULATION setting is 720 (60 months).

The result of the total payments is correctly calculated to €1200.

settings.py```
settings = {
...
"T_MAX_CALCULATION": 720,
...
}
```

<timestamp>_output.csv

```
t payment future_payments
0 0 1200
1 100 1200
2 100 1100
3 100 1000
4 100 900
5 100 800
6 100 700
7 100 600
8 100 500
9 100 400
10 100 300
11 100 200
12 100 100
13 0 0
...
719 0 0
720 0 0
```

The cash flows only appear until the 12^{th} period.
So if we change the T_MAX_CALCULATION setting to 12, there will be no impact on the result.
Let's try it out.

```
settings = {
...
"T_MAX_CALCULATION": 12,
...
}
```

<timestamp>_output.csv

```
t payment future_payments
0 0 1200
1 100 1200
2 100 1100
3 100 1000
4 100 900
5 100 800
6 100 700
7 100 600
8 100 500
9 100 400
10 100 300
11 100 200
12 100 100
```

The total value of future payments is again correctly calculated and amounts to €1200.

However, if we incorrectly set the T_MAX_CALCULATION setting to something lower than 12, then we will get incorrect results. Let's set the maximal calculation period to 8.

settings.py```
settings = {
...
"T_MAX_CALCULATION": 8,
...
}
```

<timestamp>_output.csv

```
t payment future_payments
0 0 800
1 100 800
2 100 700
3 100 600
4 100 500
5 100 400
6 100 300
7 100 200
8 100 100
```

The value of future payments has been calculated as €800 instead of €1200. This is an incorrect answer because we have decreased the horizon too much.

## Maximal output period

So far, we have discussed the T_MAX_CALCULATION setting which reflects the projection horizon for the underlying calculation.

A similar setting is T_MAX_OUTPUT. The T_MAX_OUTPUT setting reflects how many projection periods we want in the output file.

Often, these two values are the same. However, if you need only some results at t=0 there is no need to save results for all periods. Fewer projection periods in the output file mean smaller files and faster post-processing.

For example, let's set T_MAX_CALCULATION to 12 and T_MAX_OUTPUT to 0.

settings.py```
settings = {
"T_MAX_CALCULATION": 12,
"T_MAX_OUTPUT": 0,
...
}
```

Let's take a look at the results.

<timestamp>_output.csv```
t payment future_payments
0 0 1200
```

The model has calculated the correct value for future payments but saved a file with only one row. If we only need results for t=0 then it's enough. The file is smaller and easier to handle.

The value of T_MAX_OUTPUT can not exceed the value of T_MAX_CALCULATION.
If the user sets T_MAX_OUTPUT to 100 and T_MAX_CALCULATION to 12, there will be anyway only results up to the 12^{th} period.

Do you have any issues or questions? You can raise them on the GitHub repository. You can also use the comment section under this post!