Filtering extended_claims_data to large claims and add derived columns
filter_large_claims.Rd
The indexed columns allow for the exact calculation of which claim has become large and when.
Claims that have not become large yet are eliminated.
This function resembles only step 5 of the data preparation process, see description in details of prepare_data()
Usage
filter_large_claims(
extended_claims_data,
threshold,
first_orig_year,
expected_year_of_growing_large = 3
)
Arguments
- extended_claims_data
dataframe after step 4, see details of
prepare_data()
.- threshold
numeric value to separate small from large claims, see details of
prepare_data()
.- first_orig_year
Integer value for the first origin year for which a full claim history is available, see details of
prepare_data()
.- expected_year_of_growing_large
Integer Value for claims without complete history, see details, see details of
prepare_data()
.
Examples
# this example uses data provided with this package
library(dplyr)
new_data <- minimal_claims_data_xmpl %>%
reduce_data(indices_xmpl, 400000) %>%
add_missing_years(2023) %>%
add_columns() %>%
add_indexed_columns(indices_xmpl) %>%
filter_large_claims(400000, 1989, 3)
head(new_data)
#> Claim_id Origin_year Calendar_year Cl_payment_cal Cl_reserve An_payment_cal
#> 1 Claim#1 1976 1976 0 0 0
#> 2 Claim#1 1976 1977 0 0 0
#> 3 Claim#1 1976 1978 0 0 0
#> 4 Claim#1 1976 1979 0 0 0
#> 5 Claim#1 1976 1980 0 0 0
#> 6 Claim#1 1976 1981 0 0 0
#> An_reserve Development_year Payment_cal Reserve Cl_payment_cum An_payment_cum
#> 1 0 1 0 0 0 0
#> 2 0 2 0 0 0 0
#> 3 0 3 0 0 0 0
#> 4 0 4 0 0 0 0
#> 5 0 5 0 0 0 0
#> 6 0 6 0 0 0 0
#> Payment_cum Cl_incurred An_incurred Incurred Entry_cl_reserve
#> 1 0 0 0 0 0
#> 2 0 0 0 0 0
#> 3 0 0 0 0 0
#> 4 0 0 0 0 0
#> 5 0 0 0 0 0
#> 6 0 0 0 0 0
#> Entry_an_reserve Entry_reserve Ind_cl_payment_cal Ind_an_payment_cal
#> 1 0 0 0 0
#> 2 0 0 0 0
#> 3 0 0 0 0
#> 4 0 0 0 0
#> 5 0 0 0 0
#> 6 0 0 0 0
#> Ind_payment_cal Ind_cl_reserve Ind_an_reserve Ind_entry_cl_reserve
#> 1 0 0 0 0
#> 2 0 0 0 0
#> 3 0 0 0 0
#> 4 0 0 0 0
#> 5 0 0 0 0
#> 6 0 0 0 0
#> Ind_entry_an_reserve Ind_entry_reserve Ind_reserve Ind_cl_payment_cum
#> 1 0 0 0 0
#> 2 0 0 0 0
#> 3 0 0 0 0
#> 4 0 0 0 0
#> 5 0 0 0 0
#> 6 0 0 0 0
#> Ind_an_payment_cum Ind_payment_cum Ind_cl_incurred Ind_an_incurred
#> 1 0 0 0 0
#> 2 0 0 0 0
#> 3 0 0 0 0
#> 4 0 0 0 0
#> 5 0 0 0 0
#> 6 0 0 0 0
#> Ind_incurred Large_since Dev_year_of_growing_large Dev_year_since_large
#> 1 0 1978 3 -1
#> 2 0 1978 3 0
#> 3 0 1978 3 1
#> 4 0 1978 3 2
#> 5 0 1978 3 3
#> 6 0 1978 3 4