relativity_template {SynthETIC} | R Documentation |
Template to input Covariate Relativities
Description
Constructs a template for the covariate relativities based on the inputed covariates. Note that only non-zero relativities and one cross-factor relativity is needed for each factor pair.
Usage
relativity_template(factors)
Arguments
factors |
named list of vectors, containing the name of the covariates and associated factors in vector form. |
Details
Suppose that there are covariates labelled
,
,
and that covariate
can assume one and only one of
values,
,
. The total number of available covariate
values is
.
Now set up an matrix
, consisting of sub-matrices
,
of dimension
. The
diagonal blocks
will quantify first-order relativities on claims
attributes, and the off-diagonal blocks
,
will quantify
second-order effects. Let
denote the
element of
. This element operates as a multiplier of the claim attribute
when covariates
and
take values
and
respectively. Since
can assume only one of the values
,
for
, and so
is diagonal for
all
. Moreover,
, so that
is symmetric and
.
Value
Returns a dataframe object, with five columns:
factor_i | Factor i. |
factor_j | Factor j. |
level_ik | Level within Factor i. |
level_jl | Level within Factor j. |
relativity | Relativity between level_ik and level_jl , defaults to NA .
|
Examples
factors <- list(
"Legal Representation" = c("Y", "N"),
"Injury Severity" = as.character(1:6),
"Age of Claimant" = c("0-15", "15-30", "30-50", "50-65", "over 65")
)
relativity_freq <- relativity_template(factors)
relativity_sev <- relativity_template(factors)
# Default Values
relativity_freq$relativity <- c(
1, 1,
0.95, 1, 1, 1, 1, 1,
0.05, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
0.53, 0.3, 0.1, 0.05, 0.01, 0.01,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
0.183, 0.192, 0.274, 0.18, 0.171
)
relativity_sev$relativity <- c(
2, 1,
1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
0.6, 1.2, 2.5, 5, 8, 0.4,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 0.97, 0.95,
1, 1, 1, 0.95, 0.9,
1, 1, 1, 1, 1,
1.25, 1.15, 1, 0.85, 0.7
)
head(relativity_freq)
head(relativity_sev)
test_covariates_obj <- covariates(factors)
test_covariates_obj <- set.covariates_relativity(
covariates = test_covariates_obj,
relativity = relativity_freq,
freq_sev = "freq"
)
test_covariates_obj <- set.covariates_relativity(
covariates = test_covariates_obj,
relativity = relativity_sev,
freq_sev = "sev"
)