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.
relativity_template(factors)
Arguments
factors: named list of vectors, containing the name of the covariates and associated factors in vector form.
Returns
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 .
Details
Suppose that there are m covariates labelled ci, i=1,...,m, and that covariate ci can assume one and only one of ni values, xik, k=1,...,ni. The total number of available covariate values is n=∑i=1mno.
Now set up an n×n matrix F, consisting of sub-matrices Fij, i,j=1,...,m of dimension ni×nj. The diagonal blocks Fii will quantify first-order relativities on claims attributes, and the off-diagonal blocks Fij, j=i will quantify second-order effects. Let fij,kl denote the (k,l) element of Fij. This element operates as a multiplier of the claim attribute when covariates ci and cj take values xik and xjl
respectively. Since ci can assume only one of the values xik, fii,kl=0 for k=l, and so Fii is diagonal for all i=1,...,m. Moreover, fij,kl=fji,lk, so that F is symmetric and fij,kl>0.