{"word_count": 587, "character_count": 3863}
A couple of weeks ago, I had a discussion with a practitioner, working in some financial company, about ruin, and infinite time. And it reminded me a weird result. Well, not a weird result, but a result I found disturbing, at first, when I was a student (that I rediscovered with the eyes of someone dealing with computational issues, seeing here a difficult theoretical question). Consider a simple ruin problem. A player has wealth . Then he flips a coin: tails he has a gain of 1, heads he experiences a loss of 1. At time , his wealth is where  is associated to the th coin:  is equal to 1 with probability (tails), and -1 with probability  (heads). It is also possible to writewhere  can be interpreted as the net gain of the player. In order to get a good understanding of results that can be obtained. Assume  to be given. Let denote the number of heads and  the number of tails. Then , while . Let  denote the number of paths to go from point A (wealth  at time ) to point B (wealth  at time ). Note that this is a Markovian problem, that can be modeled using Markov chainsBut here, we will focus on combinatorial results. Hence,In order to derive probabilities to reach , let  denote the number of paths going from  to . And let denote the number of paths going from  to  that do reach  at some point between  and . Using a simple reflexion property, then if  and  are positive,Based on those reflexions, two results can be derived (focusing on probability, instead of counting paths). First, we can obtain that(given that n and x have the same parity). The second result we can obtain is thatBased on those two expressions, if  denotes the first time  become null, given ,thenThis can be computed easily,&#62; x=10&#62; p=.55&#62; ProbN=function(n){+ pb=0+ if(abs(n-x) %% 2 == 0)+ pb=x/n*choose(n,(n+x)/2)*(1-p)^((n+x)/2)*(p)^((n-x)/2)+ return(pb)}&#62; plot(Vectorize(ProbN)(1:1000),type="s")That looks nice... But if we look closer, we can wonder whatwould be ? Since we have the distribution of a probabilty measure, we might expect one. But here&#62; sum(Vectorize(ProbN)(1:1000))[1] 0.134385And this is not due to calculation mistakes that we do not get 1 here. Actually, we should writewhich might be interpreted as the probability of ruin, starting from , that we denote  from now on. The term on the left can be approximated using monte-carlo simulations&#62; p=.55&#62; x=10&#62; m=1000&#62; simul=10000&#62; S=sample(c(-1,1),size=m*simul,replace=TRUE,prob=c(1-p,p))&#62; MS=matrix(S,simul,m)&#62; for(k in 2:m) MS[,k]=MS[,k]+MS[,k-1]&#62; T0=function(vm) which(vm&#60;=(-x))[1]&#62; MTmin=apply(MS,1,T0)&#62; mean(is.na(MTmin)==FALSE)[1] 0.1328To check the validity of the relationship above, a simple (theoretical) recursive formula can be derived for the term on the right (ruin probability), namelywith a boundary conditions , and . Then is comes thatNote that it might be tricky to check using monte carlo simulation... since we cannot have an infinite number of runs. And we're dealing precisely with things that do occur when time is infinite. Actually, we can still check convergence, considering an upper limit  for the number of runs, and then letting  go to infinity. Note that an explicit formula can then be derived (using additional border condition )Using the following code, it is possible to calculate ruin probability, in order to estimate .&#62; MSmin=apply(MS,1,min)&#62; mean(MSmin&#60;=(-x))[1] 0.1328&#62; (((1-p)/p)^x-((1-p)/p)^m)/(1-((1-p)/p)^m)[1] 0.1344306The following graph shows the evolution of ruin probability as a function of initial wealth (with monte carlo simulation, with a fixed horizon - including a confidence interval - versus the analytical expression)Hence, with stopping times, one should remember thatand that those two terms can be approximated simply using simulations or standard approximations.