To download this R package on your R session, copy-paste the next code line (the package devtools is necessary) :
devtools::install_github("gabrielcrepeault/tvarPackage")
This R package was created in the first place to calculate more quickly and easily a lot of formulas (mean, variance, VaR, TVaR, stop-loss function, etc.) related to popular probability distributions, such as :
And also some Mortality laws, like
I’ve tried to make the package pretty simple to use, the syntax is based on quite the same as some popular R package, like the stats or actuar packages :
| Formulas | code |
|---|---|
| Mean | E_<distribution> |
| Variance | V_<distribution> |
| stop loss | SL_<distribution> |
| Limited expected value | Elim_<distribution> |
| truncated mean | Etronq_<distribution> |
| Value-at-Risk | VaR_<distribution> |
| Tail Value-at-Risk | TVaR_<distribution> |
| Mean Excess-loss | Mexcess_<distribution> |
For probability laws used in life insurance, there is a special annotation (not much different from the one above) :
Tx = T si setup by default)integrate function or with floor equivalent, because there are no closed (explicit) expressions. You can call them with a slightly different syntax, Etx_<distribution>, Vtx_<distribution> and TVaRtx_<distribution>.| Formulas | code |
|---|---|
| Mortality force | h<distribution> |
| density function | d<distribution> |
| cumulative density function (cdf) | p<distribution> |
| survival function (cdf) | s<distribution> |
| Date | Modifications |
|---|---|
| 24/02/2018 | Intial commit of the package |
| 27/02/2018 | adding binomial, uniform and exponential laws |
| 04/03/2018 | adding beta distribution |
| 06/03/2018 | adding Lognormal distribution |
| 06/04/2018 | adding Pareto, Burr and Normal (E[X] & Var(X)) distribution |
| 16/04/2018 | adding Gompertz & TVaR function for binomial and poisson |