**ProbaPerception**, and kindly contributed to R-bloggers)

The merge of two insurance companies enables to curb the probability of ruin by sharing the risk and the capital of the two companies.

For example, we can consider two insurance companies, A and B. A is a well known insurance company with a big capital and is dealing with a risk with a low variance. We will assume that the global risk of all its customers follow a chi-square distribution with one degree of freedom. Besides, we assume that the initial capital of A is 3 and the premium charged to its customers is 1.05. The reason why it is charged 1.05 is a bit intricate and is not of great importance for this post, I may explain it later, in another post. The idea is that A charges a premium slightly over the expectation of a chi-square with one degree of freedom.

The second firm B is in a very different situation. This is a very new insurance company with a very low capital (let’s say 0.1). Its customers have claims which follow a chi square distribution with two degrees of freedom, which means that the insured product is more risky and the variance of the risk is higher too. B is likely to charge its customers with a higher premium than A. Indeed, B has a low capital, the expectation of the claim as well as the variance are higher. So we consider a premium of 3.

To sum up:

Capital | Premium | Claims | |

Firm A | k1 = 3 | premium1 = 1.05 | x1 ~ χ(1) |

Firm B | k2 = 0.1 | premium2 = 3 | x2 ~ χ(2) |

Finally we do a last assumption which is the independence of the claims. This assumption which seems relevant is not such a common place in real insurance problem and is a real source of interesting issues.

Every day, the firms A and B receive their premiums and pay back the claims to their customers.

The probability of ruin is, in risk management, and in the current project of risk management rules for insurances (solvency 2), the measure of interest. For a certain number of days, the company A is in a ruin situation if there has been at least one day where the total amount of claims has been greater than the sum of the initial capital and the total amount of premiums. To estimate such a probability we can easily (at least in this case) simulate the model. The probability of ruin is the probability to be in such a situation. For example, in the next plot, we can see that in a particular simulation for the firm A, A experienced a ruin as soon as the day number 7.

The red line is the company B while the black line is A and the purple line is the merged company. Both A and B have been ruined, while the merged company has not been ruined. |

__The code (R):__premium2 = 3

horizon = 100

length = 100000

# sum1 is the number of time company 1 is ruined

sum1 = 0

# sum2 is the number of time company 2 is ruined

sum2 = 0

# sum3 is the number of time companies 1 and 2 are ruined

sum3 = 0

# sum is the number of time the merge company is ruined

sum = 0

for(j in 1:length){

k1 = rep(0, horizon+1)

k2 = rep(0, horizon+1)

k = rep(0, horizon+1)

k1[1] = 3

k2[1] = 0.1

k[1] = k1[1]+k2[1]

x1 = rchisq(horizon, 1)

x2 = rchisq(horizon, 2)

ruinX1 = FALSE

ruinX2 = FALSE

ruinX = FALSE

for(i in 1:horizon){

k1[i+1] = premium1 + k1[i] – x1[i]

k2[i+1] = premium2 + k2[i] – x2[i]

k[i+1] = premium1 + premium2 + k[i] – x1[i] – x2[i]

if(k1[i+1]<0){

ruinX1 = TRUE

}

if(k2[i+1]<0){

ruinX2 = TRUE

}

if(k[i+1]<0){

ruinX = TRUE

}

}

if(ruinX1 & ruinX2){

sum3 = sum3 + 1

sum1 = sum1 + 1

sum2 = sum2 + 1

}

else if(ruinX1){

sum1 = sum1 + 1

}

else if(ruinX2){

sum2 = sum2 + 1

}

if(ruinX){

sum = sum + 1

}

}

# prob of ruin of A

prob1 = sum1 / length

# prob1

# prob of ruin of B

prob2 = sum2 / length

# prob2

# prob of ruin of the merged firm

prob = sum / length

# prob

# prob of ruin of A AND B

prob3 = sum3 / length

# prob3

plot(k1, type = ‘l’, xlab = ‘days’, ylab = ‘available capital’, ylim =c(min(k2, k, k1),max(k2, k, k1)))

lines(k2, col = ‘red’)

lines(k, col = ‘purple’)

abline(0, 0)

**leave a comment**for the author, please follow the link and comment on their blog:

**ProbaPerception**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...