Skip to contents

Generate annuities prediction per development year from rolled out single annuities

Usage

generate_annuities_prediction(
  annuities,
  annuities_rolled_out,
  first_orig_year,
  last_orig_year
)

Arguments

annuities

dataframe, see description of pool_of_annuities in details of prepare_data().

annuities_rolled_out

matrix as result of roll_out_annuity()

first_orig_year

Integer value for the first origin year, will be treated as the first observed calendar year.

last_orig_year

Integer value for the last origin year which will also be treated as the last calendar year, usually the calendar year that just ended.

Value

numeric matrix with one row per year between first_orig_year and last_orig_year and 250 columns for predicted 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

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

# only print the first 10 columns
generate_annuities_prediction(annuities = minimal_active_annuities_xmpl,
                              annuities_rolled_out = annuities_rolled_out,
                              first_orig_year = 1989,
                              last_orig_year = 2023)[,1:10]
#>          2024     2025     2026     2027     2028     2029     2030     2031
#> 1989     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1990 11807.36 11807.36 11807.36 11807.36 11807.36 11807.36 11807.36 11807.36
#> 1991     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1992     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1993     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1994     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1995     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1996     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1997     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1998     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 1999     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2000     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2001     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2002     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2003     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2004     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2005     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2006 12168.21     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2007     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2008     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2009     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2010     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2011     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2012     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2013     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2014     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2015     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2016     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2017     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2018     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2019     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2020     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2021     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2022     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#> 2023     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00
#>      2032 2033
#> 1989    0    0
#> 1990    0    0
#> 1991    0    0
#> 1992    0    0
#> 1993    0    0
#> 1994    0    0
#> 1995    0    0
#> 1996    0    0
#> 1997    0    0
#> 1998    0    0
#> 1999    0    0
#> 2000    0    0
#> 2001    0    0
#> 2002    0    0
#> 2003    0    0
#> 2004    0    0
#> 2005    0    0
#> 2006    0    0
#> 2007    0    0
#> 2008    0    0
#> 2009    0    0
#> 2010    0    0
#> 2011    0    0
#> 2012    0    0
#> 2013    0    0
#> 2014    0    0
#> 2015    0    0
#> 2016    0    0
#> 2017    0    0
#> 2018    0    0
#> 2019    0    0
#> 2020    0    0
#> 2021    0    0
#> 2022    0    0
#> 2023    0    0