The Inclusion of Claim Covariates in the Generation of SynthETIC Claims

This vignette aims to illustrate how the inclusion of covariates can influence the severity of the claims generated using the SynthETIC package. The distributional assumptions shown in this vignette are consistent with the default assumptions of the SynthETIC package (an Auto Liability portfolio). The inclusion of covariates aims to be a minor adjustment step to modelled claim sizes after Step 2: Claim size discussed in the SynthETIC-demo vignette.

In particular, with this demo we will construct:

Description R Object
Covariate Inputs covariate_obj = various factors, their levels and relativities for covariate frequency and claim severity
Covariate Outputs covariates_data_obj = dataset of assigned covariates for each claim
S_adj, claim size claim_size_w_cov[[i]] = claim size for all claims that occurred in period i after adjustment for covariates

Reference

To cite this package in publications, please use:

citation("SynthETIC")

SynthETIC Set Up

We set up package-wise global parameters demonstrated in the SynthETIC-demo vignette (which can be accessed via vignette("SynthETIC-demo", package = "SynthETIC") or online documentation) and perform modelling Steps 1 and 2 to generate the claim frequency and claim sizes under the default assumptions. Note that changing these assumptions for Steps 1 and 2 do not affect how covariates are implemented.

library(SynthETIC)
set.seed(20200131)

set_parameters(ref_claim = 200000, time_unit = 1/4)
ref_claim <- return_parameters()[1]
time_unit <- return_parameters()[2]

years <- 10
I <- years / time_unit
E <- c(rep(12000, I)) # effective annual exposure rates
lambda <- c(rep(0.03, I))

# Modelling Steps 1-2
n_vector <- claim_frequency(I = I, E = E, freq = lambda)
occurrence_times <- claim_occurrence(frequency_vector = n_vector)
claim_sizes <- claim_size(frequency_vector = n_vector)

Applying Covariates

To apply simulated covariates to SynthETIC claim sizes, a covariates is used in conjunction with the claim_size_adj() function to both simulate covariate combinations and apply adjusted claim sizes. The example covariates object below includes relativities for

  1. the legal representation of the claim
  2. the injury severity score
  3. the age of the claimant.
test_covariates_obj <- SynthETIC::test_covariates_obj
print(test_covariates_obj)
#> $factors
#> $factors$`Legal Representation`
#> [1] "Y" "N"
#> 
#> $factors$`Injury Severity`
#> [1] "1" "2" "3" "4" "5" "6"
#> 
#> $factors$`Age of Claimant`
#> [1] "0-15"    "15-30"   "30-50"   "50-65"   "over 65"
#> 
#> 
#> $relativity_freq
#>                factor_i             factor_j level_ik level_jl relativity
#> 1  Legal Representation Legal Representation        Y        Y      1.000
#> 2  Legal Representation Legal Representation        N        N      1.000
#> 3  Legal Representation      Injury Severity        Y        1      0.950
#> 4  Legal Representation      Injury Severity        Y        2      1.000
#> 5  Legal Representation      Injury Severity        Y        3      1.000
#> 6  Legal Representation      Injury Severity        Y        4      1.000
#> 7  Legal Representation      Injury Severity        Y        5      1.000
#> 8  Legal Representation      Injury Severity        Y        6      1.000
#> 9  Legal Representation      Injury Severity        N        1      0.050
#> 10 Legal Representation      Injury Severity        N        2      0.000
#> 11 Legal Representation      Injury Severity        N        3      0.000
#> 12 Legal Representation      Injury Severity        N        4      0.000
#> 13 Legal Representation      Injury Severity        N        5      0.000
#> 14 Legal Representation      Injury Severity        N        6      0.000
#> 15 Legal Representation      Age of Claimant        Y     0-15      1.000
#> 16 Legal Representation      Age of Claimant        Y    15-30      1.000
#> 17 Legal Representation      Age of Claimant        Y    30-50      1.000
#> 18 Legal Representation      Age of Claimant        Y    50-65      1.000
#> 19 Legal Representation      Age of Claimant        Y  over 65      1.000
#> 20 Legal Representation      Age of Claimant        N     0-15      1.000
#> 21 Legal Representation      Age of Claimant        N    15-30      1.000
#> 22 Legal Representation      Age of Claimant        N    30-50      1.000
#> 23 Legal Representation      Age of Claimant        N    50-65      1.000
#> 24 Legal Representation      Age of Claimant        N  over 65      1.000
#> 25      Injury Severity      Injury Severity        1        1      0.530
#> 26      Injury Severity      Injury Severity        2        2      0.300
#> 27      Injury Severity      Injury Severity        3        3      0.100
#> 28      Injury Severity      Injury Severity        4        4      0.050
#> 29      Injury Severity      Injury Severity        5        5      0.010
#> 30      Injury Severity      Injury Severity        6        6      0.010
#> 31      Injury Severity      Age of Claimant        1     0-15      1.000
#> 32      Injury Severity      Age of Claimant        1    15-30      1.000
#> 33      Injury Severity      Age of Claimant        1    30-50      1.000
#> 34      Injury Severity      Age of Claimant        1    50-65      1.000
#> 35      Injury Severity      Age of Claimant        1  over 65      1.000
#> 36      Injury Severity      Age of Claimant        2     0-15      1.000
#> 37      Injury Severity      Age of Claimant        2    15-30      1.000
#> 38      Injury Severity      Age of Claimant        2    30-50      1.000
#> 39      Injury Severity      Age of Claimant        2    50-65      1.000
#> 40      Injury Severity      Age of Claimant        2  over 65      1.000
#> 41      Injury Severity      Age of Claimant        3     0-15      1.000
#> 42      Injury Severity      Age of Claimant        3    15-30      1.000
#> 43      Injury Severity      Age of Claimant        3    30-50      1.000
#> 44      Injury Severity      Age of Claimant        3    50-65      1.000
#> 45      Injury Severity      Age of Claimant        3  over 65      1.000
#> 46      Injury Severity      Age of Claimant        4     0-15      1.000
#> 47      Injury Severity      Age of Claimant        4    15-30      1.000
#> 48      Injury Severity      Age of Claimant        4    30-50      1.000
#> 49      Injury Severity      Age of Claimant        4    50-65      1.000
#> 50      Injury Severity      Age of Claimant        4  over 65      1.000
#> 51      Injury Severity      Age of Claimant        5     0-15      1.000
#> 52      Injury Severity      Age of Claimant        5    15-30      1.000
#> 53      Injury Severity      Age of Claimant        5    30-50      1.000
#> 54      Injury Severity      Age of Claimant        5    50-65      1.000
#> 55      Injury Severity      Age of Claimant        5  over 65      1.000
#> 56      Injury Severity      Age of Claimant        6     0-15      1.000
#> 57      Injury Severity      Age of Claimant        6    15-30      1.000
#> 58      Injury Severity      Age of Claimant        6    30-50      1.000
#> 59      Injury Severity      Age of Claimant        6    50-65      1.000
#> 60      Injury Severity      Age of Claimant        6  over 65      1.000
#> 61      Age of Claimant      Age of Claimant     0-15     0-15      0.183
#> 62      Age of Claimant      Age of Claimant    15-30    15-30      0.192
#> 63      Age of Claimant      Age of Claimant    30-50    30-50      0.274
#> 64      Age of Claimant      Age of Claimant    50-65    50-65      0.180
#> 65      Age of Claimant      Age of Claimant  over 65  over 65      0.171
#> 
#> $relativity_sev
#>                factor_i             factor_j level_ik level_jl relativity
#> 1  Legal Representation Legal Representation        Y        Y       2.00
#> 2  Legal Representation Legal Representation        N        N       1.00
#> 3  Legal Representation      Injury Severity        Y        1       1.00
#> 4  Legal Representation      Injury Severity        Y        2       1.00
#> 5  Legal Representation      Injury Severity        Y        3       1.00
#> 6  Legal Representation      Injury Severity        Y        4       1.00
#> 7  Legal Representation      Injury Severity        Y        5       1.00
#> 8  Legal Representation      Injury Severity        Y        6       1.00
#> 9  Legal Representation      Injury Severity        N        1       1.00
#> 10 Legal Representation      Injury Severity        N        2       1.00
#> 11 Legal Representation      Injury Severity        N        3       1.00
#> 12 Legal Representation      Injury Severity        N        4       1.00
#> 13 Legal Representation      Injury Severity        N        5       1.00
#> 14 Legal Representation      Injury Severity        N        6       1.00
#> 15 Legal Representation      Age of Claimant        Y     0-15       1.00
#> 16 Legal Representation      Age of Claimant        Y    15-30       1.00
#> 17 Legal Representation      Age of Claimant        Y    30-50       1.00
#> 18 Legal Representation      Age of Claimant        Y    50-65       1.00
#> 19 Legal Representation      Age of Claimant        Y  over 65       1.00
#> 20 Legal Representation      Age of Claimant        N     0-15       1.00
#> 21 Legal Representation      Age of Claimant        N    15-30       1.00
#> 22 Legal Representation      Age of Claimant        N    30-50       1.00
#> 23 Legal Representation      Age of Claimant        N    50-65       1.00
#> 24 Legal Representation      Age of Claimant        N  over 65       1.00
#> 25      Injury Severity      Injury Severity        1        1       0.60
#> 26      Injury Severity      Injury Severity        2        2       1.20
#> 27      Injury Severity      Injury Severity        3        3       2.50
#> 28      Injury Severity      Injury Severity        4        4       5.00
#> 29      Injury Severity      Injury Severity        5        5       8.00
#> 30      Injury Severity      Injury Severity        6        6       0.40
#> 31      Injury Severity      Age of Claimant        1     0-15       1.00
#> 32      Injury Severity      Age of Claimant        1    15-30       1.00
#> 33      Injury Severity      Age of Claimant        1    30-50       1.00
#> 34      Injury Severity      Age of Claimant        1    50-65       1.00
#> 35      Injury Severity      Age of Claimant        1  over 65       1.00
#> 36      Injury Severity      Age of Claimant        2     0-15       1.00
#> 37      Injury Severity      Age of Claimant        2    15-30       1.00
#> 38      Injury Severity      Age of Claimant        2    30-50       1.00
#> 39      Injury Severity      Age of Claimant        2    50-65       1.00
#> 40      Injury Severity      Age of Claimant        2  over 65       1.00
#> 41      Injury Severity      Age of Claimant        3     0-15       1.00
#> 42      Injury Severity      Age of Claimant        3    15-30       1.00
#> 43      Injury Severity      Age of Claimant        3    30-50       1.00
#> 44      Injury Severity      Age of Claimant        3    50-65       1.00
#> 45      Injury Severity      Age of Claimant        3  over 65       1.00
#> 46      Injury Severity      Age of Claimant        4     0-15       1.00
#> 47      Injury Severity      Age of Claimant        4    15-30       1.00
#> 48      Injury Severity      Age of Claimant        4    30-50       1.00
#> 49      Injury Severity      Age of Claimant        4    50-65       0.97
#> 50      Injury Severity      Age of Claimant        4  over 65       0.95
#> 51      Injury Severity      Age of Claimant        5     0-15       1.00
#> 52      Injury Severity      Age of Claimant        5    15-30       1.00
#> 53      Injury Severity      Age of Claimant        5    30-50       1.00
#> 54      Injury Severity      Age of Claimant        5    50-65       0.95
#> 55      Injury Severity      Age of Claimant        5  over 65       0.90
#> 56      Injury Severity      Age of Claimant        6     0-15       1.00
#> 57      Injury Severity      Age of Claimant        6    15-30       1.00
#> 58      Injury Severity      Age of Claimant        6    30-50       1.00
#> 59      Injury Severity      Age of Claimant        6    50-65       1.00
#> 60      Injury Severity      Age of Claimant        6  over 65       1.00
#> 61      Age of Claimant      Age of Claimant     0-15     0-15       1.25
#> 62      Age of Claimant      Age of Claimant    15-30    15-30       1.15
#> 63      Age of Claimant      Age of Claimant    30-50    30-50       1.00
#> 64      Age of Claimant      Age of Claimant    50-65    50-65       0.85
#> 65      Age of Claimant      Age of Claimant  over 65  over 65       0.70
#> 
#> attr(,"class")
#> [1] "covariates"

The claim_size_adj() function simulates the covariate levels for each claim and then adjusts the claim sizes according to the relativities defined above. The covariate levels for each claim can be accessed in the covariates_data$data attribute of the function output.

claim_size_covariates <- claim_size_adj(test_covariates_obj, claim_sizes)
covariates_data_obj <- claim_size_covariates$covariates_data
head(data.frame(covariates_data_obj$data))
#>   Legal.Representation Injury.Severity Age.of.Claimant
#> 1                    Y               2           30-50
#> 2                    Y               4           15-30
#> 3                    Y               1           50-65
#> 4                    N               1           50-65
#> 5                    Y               1           30-50
#> 6                    Y               1           50-65

The adjusted claim sizes are stored in the claim_size_adj attribute.

claim_size_w_cov <- claim_size_covariates$claim_size_adj
claim_size_w_cov[[1]]
#>  [1] 7.666022e+05 1.005209e+06 1.284578e+04 1.036465e+01 7.006114e+03
#>  [6] 2.827259e+05 3.847565e+03 5.892911e+03 4.782818e+04 4.394902e+03
#> [11] 4.460240e+04 3.522547e+04 5.900835e+04 2.272439e+03 2.476781e+05
#> [16] 7.782617e+05 3.984604e+02 2.469186e+05 1.335239e+03 7.564400e+05
#> [21] 1.904774e+03 1.946348e+05 1.494095e+04 1.836781e+05 9.672525e+03
#> [26] 6.001668e+05 2.145447e+05 4.998511e+04 6.852297e+04 8.492706e+04
#> [31] 2.539633e+04 6.937409e+04 4.795315e+04 2.083838e+05 1.528371e+05
#> [36] 7.733007e+04 3.114740e+02 6.817834e+04 4.040597e+04 1.427551e+04
#> [41] 1.358240e+05 2.946501e+04 6.324633e+03 1.500005e+03 1.982045e+05
#> [46] 8.212089e+04 6.422176e+04 2.272206e+04 1.378759e+03 3.097580e+04
#> [51] 5.589486e+04 3.628419e+05 2.872958e+05 5.504413e+05 2.956255e+03
#> [56] 6.409834e+04 4.813343e+02 1.169785e+04 1.126817e+04 1.336531e+04
#> [61] 9.453789e+04 5.950057e+04 4.891781e+04 1.640744e+05 1.775021e+04
#> [66] 6.294621e+04 2.348470e+06 1.318908e+04 1.372199e+04 1.338585e+05
#> [71] 1.014638e+05 1.216331e+05 1.182012e+05 1.170803e+04 5.613329e+04
#> [76] 6.647370e+04 1.045234e+06 4.084667e+05 1.189445e+05 2.513230e+04
#> [81] 1.847098e+05 2.273390e+05 1.239820e+05 5.676349e+03 6.992102e+04
#> [86] 1.054982e+03 6.967301e+03 6.002699e+04 6.057940e+04 7.532529e+05

Modelling Steps 3-5

Just as in Steps 1-2, Steps 3 onwards also do not require any specific adjustment in relation to implementing covariates. Guidance on implementing these modelling steps can be found in the SynthETIC-demo vignette. We can see from the example below that the inclusion of covariates primarily has an impact on claim sizes and thus any following modelling steps that are also impacted from the adjusted claim sizes. Note that the number of claims (n_vector) and the time at which they occur (occurrence_times) are unaffected by covariates.

generate_claims_dataset <- function(claim_size_list) {
    
    # SynthETIC Steps 3-5
    notidel <- claim_notification(n_vector, claim_size_list)
    setldel <- claim_closure(n_vector, claim_size_list)
    no_payments <- claim_payment_no(n_vector, claim_size_list)
    
    claim_dataset <- generate_claim_dataset(
      frequency_vector = n_vector,
      occurrence_list = occurrence_times,
      claim_size_list = claim_size_list,
      notification_list = notidel,
      settlement_list = setldel,
      no_payments_list = no_payments
    )
    
    claim_dataset
}

claim_dataset <- generate_claims_dataset(claim_size_list = claim_sizes)
claim_dataset_w_cov <- generate_claims_dataset(claim_size_list = claim_size_w_cov)

head(claim_dataset)
#>   claim_no occurrence_period occurrence_time   claim_size   notidel   setldel
#> 1        1                 1       0.6238351 783769.11073 0.6062728 36.072902
#> 2        2                 1       0.1206679 214480.60483 0.8201482 13.096504
#> 3        3                 1       0.2220436  30902.21786 3.9223677  4.175053
#> 4        4                 1       0.4538309     49.86708 1.0716224  0.801707
#> 5        5                 1       0.5910992  14326.01244 2.3997096  4.045862
#> 6        6                 1       0.9524492 680134.40835 1.4803570  6.235369
#>   no_payment
#> 1         11
#> 2          5
#> 3          4
#> 4          2
#> 5          2
#> 6          8
head(claim_dataset_w_cov)
#>   claim_no occurrence_period occurrence_time   claim_size   notidel   setldel
#> 1        1                 1       0.6238351 7.666022e+05 2.0308577  7.174268
#> 2        2                 1       0.1206679 1.005209e+06 0.6969231 47.142615
#> 3        3                 1       0.2220436 1.284578e+04 0.7560917  2.897253
#> 4        4                 1       0.4538309 1.036465e+01 0.5253115  2.173519
#> 5        5                 1       0.5910992 7.006114e+03 4.4969109  2.194843
#> 6        6                 1       0.9524492 2.827259e+05 1.7386612  7.068705
#>   no_payment
#> 1          7
#> 2         15
#> 3          3
#> 4          2
#> 5          1
#> 6         12

Appendix 1: Using Different Sets of Covariates

This section shows the impact of using a set of covariates different than the default values within the SynthETIC package.

The included framework allows a user to easily construct any set of covariates required for simulation and/or analysis. This gives the user flexibility in choosing both the number of factors in the set of covariates and the number of levels within each factor.

The below example compares

  • the default data set (without any covariate adjustments)
  • an example set of three covariates included with SynthETIC
  • a custom set of two covariates related to vehicle type and vehicle use-case (an example more relevant if studying motor claims).
factors_tmp <- list(
    "Vehicle Type" = c("Passenger", "Light Commerical", "Medium Goods", "Heavy Goods"),
    "Business Use" = c("Y", "N")
)

relativity_freq_tmp <- relativity_template(factors_tmp)
relativity_sev_tmp <- relativity_template(factors_tmp)

# Default Values
relativity_freq_tmp$relativity <- c(
    5, 1.5, 0.35, 0.25,
    1, 4,
    1, 0.6,
    0.35, 0.01,
    0.25, 0,
    2.5, 5
)

relativity_sev_tmp$relativity <- c(
    0.25, 0.75, 1, 3,
    1, 1,
    1, 1,
    1, 1,
    1, 1,
    1.3, 1
)

test_covariates_obj_veh <- covariates(factors_tmp)
test_covariates_obj_veh <- set.covariates_relativity(
    covariates = test_covariates_obj_veh, 
    relativity = relativity_freq_tmp, 
    freq_sev = "freq"
)
test_covariates_obj_veh <- set.covariates_relativity(
    covariates = test_covariates_obj_veh, 
    relativity = relativity_sev_tmp, 
    freq_sev = "sev"
)

claim_size_covariates_veh <- claim_size_adj(test_covariates_obj_veh, claim_sizes)

# Comparison of the same claim size except with adjustments due to covariates
data.frame(
    Claim_Size = head(round(claim_sizes[[1]]))
    ,Claim_Size_Original_Covariates = head(round(claim_size_covariates$claim_size_adj[[1]]))
    ,Claim_Size_New_Covariates = head(round(claim_size_covariates_veh$claim_size_adj[[1]]))
)
#>   Claim_Size Claim_Size_Original_Covariates Claim_Size_New_Covariates
#> 1     783769                         766602                    636312
#> 2     214481                        1005209                    174128
#> 3      30902                          12846                     25088
#> 4         50                             10                        40
#> 5      14326                           7006                     11631
#> 6     680134                         282726                   1656524

# Covariate Levels
head(claim_size_covariates$covariates_data$data)
#>   Legal Representation Injury Severity Age of Claimant
#> 1                    Y               2           30-50
#> 2                    Y               4           15-30
#> 3                    Y               1           50-65
#> 4                    N               1           50-65
#> 5                    Y               1           30-50
#> 6                    Y               1           50-65
head(claim_size_covariates_veh$covariates_data$data)
#>       Vehicle Type Business Use
#> 1        Passenger            N
#> 2        Passenger            N
#> 3        Passenger            N
#> 4        Passenger            N
#> 5        Passenger            N
#> 6 Light Commerical            N

Appendix 2: Applying Known Covariate Values

To apply specific covariate values for each claim occurrence, we can use the parameter covariates_id when constructing the covariates_data object. This would map the each claim to a corresponding known covariate value from a dataset and apply the relevant severity relativities. Note that in this case, the frequency relativities would not be used, as no simulation of covariate values are performed.

In the example below, we have a known dataset of covariates, which can be mapped to each of the claim sizes. In the covariates dataset, we know:

  • The first 25 rows are Passenger vehicles not for Business Use
  • The next 25 rows are Light Commercial vehicles not for Business Use
  • The next 25 rows are Passenger vehicles for Business Use
  • The last 25 rows are Light Commercial vehicles for Business Use

As a result, we can use the indices for each of these rows to map each set of covariates to its associated claim. In this case, the first 50 claims are related to the last 50 rows in the covariates dataset in reverse order, and claims 51–100 are related to the first 50 rows in the covariates dataset.

claim_sizes_known <- list(c(
    rexp(n = 100, rate = 1.5)
))

known_covariates_dataset <- data.frame(
    "Vehicle Type" = rep(rep(c("Passenger", "Light Commerical"), each = 25), times = 2),
    "Business Use" = c(rep("N", times = 50), rep("Y", times = 50))
)
colnames(known_covariates_dataset) <- c("Vehicle Type", "Business Use")

covariates_data_veh <- covariates_data(
    test_covariates_obj_veh, 
    data = known_covariates_dataset, 
    covariates_id = list(c(100:51, 1:50))
)

claim_sizes_adj_tmp <- claim_size_adj.fit(
    covariates_data = covariates_data_veh,
    claim_size = claim_sizes_known
)

head(claim_sizes_adj_tmp[[1]])
#> [1] 1.9106215 0.4859889 0.0623554 0.8976290 0.3195687 1.0285087