Learn R Programming

ruin

Overview

The intention of the package is to provide simulation methods of common risk processes in a framework of ruin theory. Each model is implemented as an S4 class, having a simulator of its path, and a plotting function. Further, a Monte-Carlo estimator of a ruin probability for a finite time is implemented, using a parallel computation. Currently, the package extends two classical risk models, namely, Cramer-Lundberg and Sparre Andersen models by including capital injections (positive jumps).

Installation

The package is not yet submitted to CRAN. Instead, you can install ruin from github with:

# install.packages("devtools")
devtools::install_github("irudnyts/ruin")

Example

library(ruin)
#> Set default RNG to L'Ecuyer-CMRG for a safe parallel simulation.

model <- CramerLundberg(
  initial_capital = 10,
  premium_rate = 1,
  claim_poisson_arrival_rate = 1,
  claim_size_generator = rexp,
  claim_size_parameters = list(rate = 1)
)

ruin_probability(model = model, time_horizon = 10, return_paths = FALSE)
#> $ruin_probability
#> lower_bound    estimate upper_bound 
#>  0.03692248  0.04080000  0.04467752

Copy Link

Version

Install

install.packages('ruin')

Monthly Downloads

18

Version

0.1.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Iegor Rudnytskyi

Last Published

July 30th, 2018

Functions in ruin (0.1.1)

plot_path

Plot a path of the simulated ruin process
CramerLundbergCapitalInjections-class

A formal S4 class CramerLundbergCapitalInjections
CramerLundbergCapitalInjections

Constructs an object of CramerLundbergCapitalInjections S4 class
simulate_path

Generic for simulating a path of a given risk model
CramerLundberg-class

A formal S4 class CramerLundberg
PathSparreAndersen-class

A formal S4 class PathSparreAndersen
PathSparreAndersenCapitalInjections-class

A formal S4 class PathSparreAndersenCapitalInjections
SparreAndersenCapitalInjections-class

A formal S4 class SparreAndersenCapitalInjections
SparreAndersenCapitalInjections

Constructs an object of SparreAndersenCapitalInjections S4 class
CramerLundberg

Constructs an object of CramerLundberg S4 class
simulate_path,CramerLundberg-method

Simulates a path of a Cramer-Lundberg model
simulate_path,CramerLundbergCapitalInjections-method

Simulates a path of a Cramer-Lundberg model's extension with capital injections
PathCramerLundberg-class

A formal S4 class PathCramerLundberg
PathCramerLundbergCapitalInjections-class

A formal S4 class PathCramerLundbergCapitalInjections
SparreAndersen-class

A formal S4 class SparreAndersen
SparreAndersen

Constructs an object of SparreAndersen S4 class
simulate_path,SparreAndersen-method

Simulates a path of a Sparre Andersen model
simulate_path,SparreAndersenCapitalInjections-method

Simulates a path of a Sparre Andersen model's extension with capital injections
ruin_probability

Estimate a ruin probability for a finite time horizon