Skip to contents

Rolling out one or more annuities

Usage

roll_out_annuity(payments, probs, stop.at = "random_death_year")

Arguments

payments

numeric vector or matrix of agreed future payments with one row per annuity and 130 columns for future payments.

probs

numeric vector or matrix with to payments corresponding mortality probabilities. Must be of same size as payments.

stop.at

Chose between random_death_year (stochastic approach) and end_of_probs (deterministic approach). The first samples a random death year of the annuity recipient and returns the agreed payments up to that year and 0 after. The latter multiplies the payments with the corresponding mortality probabilities and returns a best estimate payment per year.

Value

numeric matrix of the same size as payments with future annuity payments.

Examples

# this example uses data provided with this package
print(minimal_active_annuities_xmpl)
#>   Claim_id Annuity_id Origin_year Calendar_year Entering_year Annuity_start
#> 1 Claim#43          1        2006          2023          2009          2009
#> 2 Claim#51          1        2010          2023          2013          2036
#> 3 Claim#13          1        1990          2023          1992          1992
#>   Annuity_end Birth_year Gender Annual_payment Dynamic
#> 1           0       1939      m       12168.21       0
#> 2        2051       1986      m       12893.00       0
#> 3           0       1958      w       11807.36       0

# Create payments matrix
payments <- generate_annuity_payments(annuities = minimal_active_annuities_xmpl,
                                      last_orig_year = 2023)
print(payments[,1:10])
#>          [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
#> [1,] 12168.21 12168.21 12168.21 12168.21 12168.21 12168.21 12168.21 12168.21
#> [2,]     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> [3,] 11807.36 11807.36 11807.36 11807.36 11807.36 11807.36 11807.36 11807.36
#>          [,9]    [,10]
#> [1,] 12168.21 12168.21
#> [2,]     0.00     0.00
#> [3,] 11807.36 11807.36

# Create probability matrix
probs <- generate_annuity_probabilities(annuities = minimal_active_annuities_xmpl,
                                        mortality = mortality_xmpl,
                                        age_shift = age_shift_xmpl)
print(probs[,1:10])
#>      [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]      [,8]
#> [1,]    0 0.2868083 0.4937320 0.6423048 0.7484672 0.8239585 0.8773790 0.9149971
#> [2,]    0 0.1136917 0.2174082 0.3115931 0.3967347 0.4733544 0.5419961 0.6032160
#> [3,]    0 0.1839400 0.3364235 0.4623482 0.5659430 0.6508416 0.7201519 0.7765189
#>           [,9]     [,10]
#> [1,] 0.9413576 0.9597385
#> [2,] 0.6575737 0.7056247
#> [3,] 0.8221835 0.8590354

# stochastic with random death year
roll_out_annuity(payments, probs, stop.at = "random_death_year")
#>          [,1]     [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,] 12168.21 12168.21    0    0    0    0    0    0    0     0     0     0
#> [2,]     0.00     0.00    0    0    0    0    0    0    0     0     0     0
#> [3,] 11807.36     0.00    0    0    0    0    0    0    0     0     0     0
#>      [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,49] [,50] [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,61] [,62] [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,73] [,74] [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,85] [,86] [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,97] [,98] [,99] [,100] [,101] [,102] [,103] [,104] [,105] [,106] [,107]
#> [1,]     0     0     0      0      0      0      0      0      0      0      0
#> [2,]     0     0     0      0      0      0      0      0      0      0      0
#> [3,]     0     0     0      0      0      0      0      0      0      0      0
#>      [,108] [,109] [,110] [,111] [,112] [,113] [,114] [,115] [,116] [,117]
#> [1,]      0      0      0      0      0      0      0      0      0      0
#> [2,]      0      0      0      0      0      0      0      0      0      0
#> [3,]      0      0      0      0      0      0      0      0      0      0
#>      [,118] [,119] [,120] [,121] [,122] [,123] [,124] [,125] [,126] [,127]
#> [1,]      0      0      0      0      0      0      0      0      0      0
#> [2,]      0      0      0      0      0      0      0      0      0      0
#> [3,]      0      0      0      0      0      0      0      0      0      0
#>      [,128] [,129] [,130]
#> [1,]      0      0      0
#> [2,]      0      0      0
#> [3,]      0      0      0

# deterministic multiplying with mortality probabilities
roll_out_annuity(payments, probs, stop.at = "end_of_probs")
#>          [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
#> [1,] 12168.21 8678.269 6160.377 4352.512 3060.705 2142.111 1492.078 1034.334
#> [2,]     0.00    0.000    0.000    0.000    0.000    0.000    0.000    0.000
#> [3,] 11807.36 9635.513 7835.086 6348.247 5125.067 4122.638 3304.267 2638.722
#>           [,9]   [,10]     [,11]     [,12]     [,13]     [,14]      [,15]
#> [1,]  713.5738  489.91  334.7208  227.5767  153.9717  103.6602   69.44326
#> [2,]    0.0000    0.00    0.0000    0.0000 2355.7066 1993.7719 1680.80789
#> [3,] 2099.5428 1664.42 1314.6251 1034.5136  811.0724  633.5287  493.00357
#>           [,16]      [,17]     [,18]     [,19]      [,20]     [,21]      [,22]
#> [1,]   46.28972   30.70185  20.26092  13.30323   8.690559   5.64832   3.652251
#> [2,] 1411.37438 1180.43237 983.34935 815.89725 674.243886 554.93924 454.897568
#> [3,]  382.21252  295.20566 227.14501 174.11422 132.957104 101.14136  76.644245
#>           [,23]      [,24]       [,25]       [,26]       [,27]       [,28]
#> [1,]   2.349417   1.503509   0.9571654   0.6061649   0.3818611   0.2392869
#> [2,] 371.376479 301.953836 244.5033443 197.1695344 158.3427454 126.6346106
#> [3,]  57.857208  43.506691  32.5888323  24.3158313  18.0721743  13.3790716
#>          [,29]      [,30]      [,31]      [,32]      [,33]      [,34]
#> [1,] 0.1491485 0.09246836 0.05702023 0.03497146 0.02133215 0.01294133
#> [2,] 0.0000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [3,] 9.8657274 7.24624521 5.30115976 3.86274307 2.80337291 2.02637138
#>            [,35]       [,36]     [,37]     [,38]     [,39]     [,40]    [,41]
#> [1,] 0.007807881 0.004684728 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> [2,] 0.000000000 0.000000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> [3,] 1.458825287 1.045987456 0.7469327 0.5312036 0.3762338 0.2653778 0.186412
#>          [,42]      [,43]      [,44]      [,45]     [,46]      [,47]      [,48]
#> [1,] 0.0000000 0.00000000 0.00000000 0.00000000 0.0000000 0.00000000 0.00000000
#> [2,] 0.0000000 0.00000000 0.00000000 0.00000000 0.0000000 0.00000000 0.00000000
#> [3,] 0.1304001 0.09083847 0.06301465 0.04352968 0.0299429 0.02050969 0.01398857
#>            [,49]       [,50]       [,51]       [,52]       [,53]       [,54]
#> [1,] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
#> [2,] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
#> [3,] 0.009500102 0.006424159 0.004325429 0.002899739 0.001935518 0.001286281
#>             [,55]       [,56]        [,57]        [,58]        [,59] [,60]
#> [1,] 0.0000000000 0.000000000 0.0000000000 0.0000000000 0.0000000000     0
#> [2,] 0.0000000000 0.000000000 0.0000000000 0.0000000000 0.0000000000     0
#> [3,] 0.0008510718 0.000560635 0.0003676794 0.0002400628 0.0001560408     0
#>      [,61] [,62] [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,73] [,74] [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,85] [,86] [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96]
#> [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#> [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>      [,97] [,98] [,99] [,100] [,101] [,102] [,103] [,104] [,105] [,106] [,107]
#> [1,]     0     0     0      0      0      0      0      0      0      0      0
#> [2,]     0     0     0      0      0      0      0      0      0      0      0
#> [3,]     0     0     0      0      0      0      0      0      0      0      0
#>      [,108] [,109] [,110] [,111] [,112] [,113] [,114] [,115] [,116] [,117]
#> [1,]      0      0      0      0      0      0      0      0      0      0
#> [2,]      0      0      0      0      0      0      0      0      0      0
#> [3,]      0      0      0      0      0      0      0      0      0      0
#>      [,118] [,119] [,120] [,121] [,122] [,123] [,124] [,125] [,126] [,127]
#> [1,]      0      0      0      0      0      0      0      0      0      0
#> [2,]      0      0      0      0      0      0      0      0      0      0
#> [3,]      0      0      0      0      0      0      0      0      0      0
#>      [,128] [,129] [,130]
#> [1,]      0      0      0
#> [2,]      0      0      0
#> [3,]      0      0      0