reservr

An R Package for loss reserving in general insurance

https://github.com/ashesitr/reservr

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

An R Package for loss reserving in general insurance

Basic Info
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 3
Created over 6 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog

README.md

reservr

Codecov test coverage R-CMD-check CRAN status <!-- badges: end -->

The goal of reservr is to provide a flexible interface for specifying distributions and fitting them to (randomly) truncated and possibly interval-censored data. It provides custom fitting algorithms to fit distributions to i.i.d. samples as well as dynnamic TensorFlow integration to allow training neural networks with arbitrary output distributions. The latter can be used to include explanatory variables in the distributional fits. Reservr also provides some tools relevant for working with its core functionality in an actuarial setting, namely the functions prob_report() and truncate_claims(), both of which make assumptions on the type of random truncation applied to the data.

Please refer to the vignettes distributions.Rmd and tensorflow.Rmd for detailed introductions.

Installation

reservr is not yet on CRAN. You can install the latest development version of reservr via r devtools::install_github("AshesITR/reservr")

You can install the released version of reservr from CRAN with: r install.packages("reservr")

If you want to use all of reservrs features, make sure to also install tensorflow.

Example

This is a basic example which shows how to fit a normal distribution to randomly truncated and censored data.

``` r library(reservr) set.seed(123) mu <- 0 sigma <- 1 N <- 1000 p_cens <- 0.8

x <- rnorm(N, mean = mu, sd = sigma) iscensored <- rbinom(N, size = 1L, prob = pcens) == 1L xlower <- x xlower[iscensored] <- x[iscensored] - runif(sum(iscensored), min = 0, max = 0.5) xupper <- x xupper[iscensored] <- x[iscensored] + runif(sum(iscensored), min = 0, max = 0.5)

tlower <- runif(N, min = -2, max = 0) tupper <- runif(N, min = 0, max = 2)

isobserved <- tlower <= x & x <= t_upper

obs <- truncobs( xmin = pmax(xlower, tlower)[isobserved], xmax = pmin(xupper, tupper)[isobserved], tmin = tlower[isobserved], tmax = tupper[is_observed] )

Summary of the simulation

cat(sprintf( "simulated samples: %d\nobserved samples: %d\ncensored samples: %d\n", N, nrow(obs), sum(is.na(obs$x)) ))

Define outcome distribution and perform fit to truncated and (partially) censored sample

dist <- distnormal() thefit <- fit(dist, obs)

Visualize resulting parameters and show a kernel density estimate of the samples.

We replace interval-censored samples with their midpoint for the kernel density estimate.

plotdistributions( true = dist, fitted = dist, empirical = distempirical(0.5 * (obs$xmin + obs$xmax)), .x = seq(-5, 5, length.out = 201), plots = "density", withparams = list( true = list(mean = mu, sd = sigma), fitted = thefit$params ) ) ```

Code of Conduct

Please note that the reservr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Owner

  • Login: AshesITR
  • Kind: user

GitHub Events

Total
  • Watch event: 2
Last Year
  • Watch event: 2

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 190
  • Total Committers: 3
  • Avg Commits per committer: 63.333
  • Development Distribution Score (DDS): 0.037
Past Year
  • Commits: 17
  • Committers: 1
  • Avg Commits per committer: 17.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Alexander Rosenstock a****k@w****e 183
AxelBuecher 5****r 5
Alexander Rosenstock A****k@w****e 2

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 10
  • Total pull requests: 4
  • Average time to close issues: 4 months
  • Average time to close pull requests: 3 days
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 1
  • Average time to close issues: 10 days
  • Average time to close pull requests: less than a minute
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • AshesITR (10)
Pull Request Authors
  • AshesITR (4)
Top Labels
Issue Labels
documentation (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 591 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: reservr

Fit Distributions and Neural Networks to Censored and Truncated Data

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 591 Last month
Rankings
Stargazers count: 24.2%
Forks count: 28.8%
Dependent packages count: 29.8%
Average: 35.2%
Dependent repos count: 35.5%
Downloads: 57.6%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 3.5 depends
  • R6 >= 2.4.1 imports
  • Rcpp * imports
  • RcppParallel * imports
  • assertthat >= 0.2.1 imports
  • generics * imports
  • glue >= 1.3.1 imports
  • keras >= 2.2.5.0 imports
  • matrixStats * imports
  • nloptr * imports
  • numDeriv * imports
  • purrr >= 0.3.3 imports
  • rlang >= 0.4.5 imports
  • stats * imports
  • utils * imports
  • callr * suggests
  • colorspace * suggests
  • covr * suggests
  • data.table * suggests
  • dplyr >= 0.8.4 suggests
  • evmix * suggests
  • fitdistrplus >= 1.0.14 suggests
  • flextable >= 0.5.8 suggests
  • formattable >= 0.2.0.1 suggests
  • furrr >= 0.1.0 suggests
  • ggplot2 >= 3.2.1 suggests
  • ggridges >= 0.5.2 suggests
  • knitr >= 1.28 suggests
  • logKDE >= 0.3.2 suggests
  • officer >= 0.3.7 suggests
  • patchwork >= 1.0.0 suggests
  • reticulate * suggests
  • rmarkdown >= 2.1 suggests
  • rstudioapi * suggests
  • tensorflow >= 2.0.0 suggests
  • testthat >= 2.1.0 suggests
  • tibble * suggests
  • tidyr >= 1.0.2 suggests