https://github.com/gabrielcrepeault/tvarPackage
R functions to calculate different VaR and TVaR of principal probability distribution
https://github.com/gabrielcrepeault/tvarPackage
formula probability probability-distribution r rpackage
Last synced: 7 months ago
JSON representation
R functions to calculate different VaR and TVaR of principal probability distribution
- Host: GitHub
- URL: https://github.com/gabrielcrepeault/tvarPackage
- Owner: gabrielcrepeault
- License: gpl-3.0
- Archived: true
- Created: 2018-02-25T04:35:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-18T03:49:08.000Z (about 5 years ago)
- Last Synced: 2024-08-13T07:11:27.437Z (10 months ago)
- Topics: formula, probability, probability-distribution, r, rpackage
- Language: R
- Homepage: https://gabrielcrepeault.github.io/tvarPackage/
- Size: 187 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - gabrielcrepeault/tvarPackage - R functions to calculate different VaR and TVaR of principal probability distribution (R)
README
---
permalink: docs/index.html
---# tvarPackage
> This package is no longer maintained. Please refer to the [`Distributacalcul_Package`](https://github.com/alec42/Distributacalcul_Package).
To download this R package on your R session, copy-paste the next code line (the package [devtools](https://cran.r-project.org/web/packages/devtools/index.html) is necessary) :
```
devtools::install_github("gabrielcrepeault/tvarPackage")
```# Introduction
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 :- Uniform
- Binomial
- Poisson
- Exponential
- Gamma
- Pareto
- Beta
- Lognormal
- Pareto
- NormalAnd also some Mortality laws, like
- Gompertz
# Formulas convention
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` ](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/00Index.html) or [`actuar`](https://cran.r-project.org/web/packages/actuar/index.html) packages :|Formulas | `code`|
|:-----------:|-----------------|
|Mean |`E_` |
|Variance |`V_` |
|stop loss |`SL_` |
|Limited expected value |`Elim_` |
|truncated mean |`Etronq_` |
|Value-at-Risk |`VaR_` |
|Tail Value-at-Risk |`TVaR_` |
|Mean Excess-loss |`Mexcess_` |## Specifications for Life insurance
For probability laws used in life insurance, there is a special annotation (not much different from the one above) :* first, you need to specify if you want to have the probability related to $X$ or $T_x$ (`Tx = T` si setup by default)
* The Mean, Variance, VaR and TVaR expressions are given as a result of the `integrate` function or with floor equivalent, because there are no *closed* (explicit) expressions. You can call them with a slightly different syntax, `Etx_`, `Vtx_` and `TVaRtx_`.
* In life insurance , we work with survival functions most of the time. So I have also defined a survival function (it's gonna save coding time and space). As the section above, the syntax is based on what's already in the most popular packages.
* There is less practical application for VaR and TVaR for life duration, so I didn't create VaR functions, since the quantilee fonction makes more sense.|Formulas | `code`|
|:-----------:|-----------------|
|Mortality force |`h` |
|density function |`d` |
|cumulative density function (cdf) |`p` |
|survival function (cdf) |`s` |# Updates
|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|
|11/12/2018 | create website to vizualise tvarPackage help|