For calculating the ruin probability with real data under different claims models
0 Stars
Updated Last
8 Years Ago
Started In
November 2014


This Julia language package is based on ruin theory in acturail field, trying to compute ruin probability with the real data in insurance company. For both of acdamic and industry using. In this package, the ruin model is considered as classical Cramér–Lundberg model. And there are some basic parameters need to be explained. Initial capital is the key factor to determine how much risk the insurance company can stand. Premium rate is annual premium ratio in the insurance company, it should be over certain level to keep company alive. And the claim is the account of the money which is paid to insurer by insurance company when there occurs an issue. The central object of the ruin theory is to investigate the probability that the insurer's surplus level eventually falls below zero (making the firm bankrupt). This quantity, called the probability of ultimate ruin. Also this package can deal with two dimensional ruin probability under different claim distribution. And there are few definitions about the two dimensional problem. Ruin of "or" means at least one of the business gets ruined, Ruin of "and" means both of the businesses get ruined. In this surplus process, claims data is fitted by exponential distribution and mixture three exponential distribution, fractional Gamma distrubition, claims size is generated by Possion process, it means the interarrivel time will be exponentially distributed. Fitting approaches are Expectation–maximization algorithm and MLE.

Claims models and claims size models will be extended in the future.




The package is for calculating the survival probability under different claims model with real data. For companies, users need to input basic real information about the companies, the requirments are presented as an example:

  • claims_data = data or file
  • loss_ratio = 0.66
  • expense_ratio = 0.27
  • duration = 10

and input the claims_data = collect(readdlm("local document path")), which can read outernal file in Julia. The format of the claims_data should be a row of data without title, or users can input the data themself. Then define the Datatype: SP = SurplusProcess( claims_data, loss_ratio, expense_ratio, duration), put the data in SP. Author is still trying to avoid of asking users to enter this code.

########## Then user can get the survival probability(survival probability + ruin probability = 1) by simply typing SurPro(SP,initial_capital::Number,D::Distributions) to get explicit solution and Simulation(SP,initial_capital::Number, years::Number, D::Distributions) to get simulation solution by MC method. Where D=distribution there are three distributions can be used for the survival probability.

  • Exp = Exponential distribution
  • MixExp = Mixture three exponential distribution
  • FG = Fractional Gamma distribution


And there are some functions for the evaluation of the fitting.

  • EMfit function. When users want to check the fitting details under mixture exponential distribution, they can input EMfit(SP, numbers of mixture exponential::Number), then the package will provide the fitting parameters to unsers.
  • QQ Plot (quantile and quantile plot) is a probability plot, which is a graphical technique for comparing two probability distributions by plotting their quantiles against each other. In QQPlot function, it will provide the comparison about QQplot between two different claims distributions by QQPlot(SP,number). Red points: Exp, Blue points: MixExp, Green points: FG.
  • PP Plot (probability-probability plot or percent-percent plot) is a probability plot for evaluating how closely two data sets agree, which plots the two cumulative distribution func- tions against each other. PPPlot(SP,number) Red points: Exp, Blue points: Mix3Exp, Green points: FG.
  • PDSum is a funtion of numerical explaination of PP Plot. The results are sum of difference of CDF. PDSum(SP,number)
  • PlotSP(SP), if user needs a survival probability comparison between different model, this code will present the survival probability against initial capital under different models.