Skip to contents

This function ingests a list of truncated reporting matrices and iteratively generates the reporting triangle that would have been available as of the maximum reference time, working from bottom to top for n snapshots.

Usage

generate_triangles(trunc_rep_mat_list)

Arguments

trunc_rep_mat_list

List of truncated reporting matrices.

Value

rep_tri_mat_list List of retrospective reporting triangles, generated by removing the bottom right observations from the truncated reporting triangle matrices.

Examples

triangle <- matrix(
  c(
    65, 46, 21, 7,
    70, 40, 20, 5,
    80, 50, 10, 10,
    100, 40, 31, 20,
    95, 45, 21, NA,
    82, 42, NA, NA,
    70, NA, NA, NA
  ),
  nrow = 7,
  byrow = TRUE
)

trunc_rts <- truncate_triangles(
  reporting_triangle = triangle,
  n = 2
)
retro_rts <- generate_triangles(
  trunc_rep_mat_list = trunc_rts
)
print(retro_rts[[1]])
#>      [,1] [,2] [,3] [,4]
#> [1,]   65   46   21    7
#> [2,]   70   40   20    5
#> [3,]   80   50   10   10
#> [4,]  100   40   31   NA
#> [5,]   95   45   NA   NA
#> [6,]   82   NA   NA   NA
print(retro_rts[[2]])
#>      [,1] [,2] [,3] [,4]
#> [1,]   65   46   21    7
#> [2,]   70   40   20    5
#> [3,]   80   50   10   NA
#> [4,]  100   40   NA   NA
#> [5,]   95   NA   NA   NA