Skip to contents

This function ingests a list of truncated reporting triangles and iteratively generates the reporting triangle that would have been available as of the maximum reference time. It operates on each element in the list in order (from most recent retrospective nowcast time to oldest retrospective nowcast time).

Usage

construct_triangles(
  truncated_reporting_triangles,
  structure = 1,
  validate = TRUE
)

Arguments

truncated_reporting_triangles

List of n truncated reporting triangle matrices with as many rows as available given the truncation.

structure

Integer or vector specifying the reporting structure. If integer, divides columns evenly by that integer (with last possibly truncated). If vector, the sum must not be greater than or equal to the number of columns. Default is 1 (standard triangular structure).

validate

Logical. If TRUE (default), validates the object. Set to FALSE only when called from functions that already validated.

Value

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

See also

Retrospective data generation functions construct_triangle(), truncate_triangle(), truncate_triangles()

Examples

# Generate retrospective triangles from truncated triangles
trunc_rts <- truncate_triangles(example_reporting_triangle, n = 2)
retro_rts <- construct_triangles(trunc_rts)

# With custom structure
retro_rts_custom <- construct_triangles(
  trunc_rts,
  structure = 2
)
retro_rts_custom
#> [[1]]
#> Reporting Triangle
#> Delays unit: days
#> Reference dates: 2024-01-01 to 2024-01-04
#> Max delay: 3
#> Structure: 1
#> 
#>              0  1  2  3
#> 2024-01-01  80 50 25 10
#> 2024-01-02 100 50 20 NA
#> 2024-01-03  90 45 NA NA
#> 2024-01-04 110 NA NA NA
#> 
#> [[2]]
#> Reporting Triangle
#> Delays unit: days
#> Reference dates: 2024-01-01 to 2024-01-03
#> Max delay: 3
#> Structure: 2
#> 
#>              0  1  2  3
#> 2024-01-01  80 50 25 10
#> 2024-01-02 100 50 20 NA
#> 2024-01-03  90 45 NA NA
#>