Learn R Programming

baselinenowcast (version 0.2.0)

as_ChainLadder_triangle: Convert reporting_triangle to ChainLadder triangle format

Description

This function converts a reporting_triangle object to a triangle object from the ChainLadder package. ChainLadder is a mature package for claims reserving in general insurance that provides statistical methods for analysing reporting triangles, including the chain ladder technique, bootstrap methods, and diagnostic tools. Converting to ChainLadder format enables use of these specialized methods alongside baselinenowcast's nowcasting functionality.

Usage

as_ChainLadder_triangle(x, ...)

Value

A ChainLadder triangle object (class "triangle" and "matrix"), with rows representing origin periods (reference dates) and columns representing development periods (delays).

Arguments

x

A reporting_triangle object to convert.

...

Additional arguments passed to ChainLadder::as.triangle().

Details

This function converts the reporting triangle to ChainLadder's triangle format using ChainLadder::as.triangle(). The ChainLadder package must be installed to use this function.

Once converted, you can use any ChainLadder methods such as:

  • ChainLadder::MackChainLadder() for the Mack chain ladder method

  • ChainLadder::BootChainLadder() for bootstrap chain ladder

  • Standard plotting and summary methods

Note that some ChainLadder methods may require preprocessing for sparse triangles with many zeros, which can occur in syndromic surveillance data.

To convert back to a reporting_triangle object, use as_reporting_triangle.triangle().

See Also

Reporting triangle construction and validation [.reporting_triangle(), [<-.reporting_triangle(), as.data.frame.reporting_triangle(), as.matrix.reporting_triangle(), as_reporting_triangle(), as_reporting_triangle.data.frame(), as_reporting_triangle.matrix(), as_reporting_triangle.triangle(), assert_reporting_triangle(), get_delays_from_dates(), get_delays_unit(), get_max_delay(), get_mean_delay(), get_quantile_delay(), get_reference_dates(), get_report_dates(), get_reporting_structure(), head.reporting_triangle(), is_reporting_triangle(), new_reporting_triangle(), print.reporting_triangle(), reporting_triangle-class, summary.reporting_triangle(), tail.reporting_triangle(), truncate_to_delay(), truncate_to_quantile(), validate_reporting_triangle()

Examples

Run this code
if (FALSE) { # requireNamespace("ChainLadder", quietly = TRUE)
# Create a reporting triangle from synthetic NSSP data
data_as_of_df <- syn_nssp_df[syn_nssp_df$report_date <= "2026-04-01", ]
rep_tri <- as_reporting_triangle(data = data_as_of_df)

# Convert to ChainLadder triangle format
cl_triangle <- as_ChainLadder_triangle(rep_tri)
print(cl_triangle)

# Visualize the reporting triangle structure
plot(cl_triangle)
}

Run the code above in your browser using DataLab