Defines functions computeRuin

Documented in computeRuin

computeRuin <-
    #Computes U0, theta or eps when the two other values are given
    #Uses Lundberg's exponential bound
    #U0: initial capital
    #theta: safety loading
    #eps: probability of ruin
       R <- solveLund(alpha,beta,theta)
       if(R < 1e-6) stop("Safety loading is too small")
          U0 <- -log(eps)/R
       }else if(is.null(eps)){
           eps <- exp(-R*U0)}
       R <- -log(eps)/U0
       if(R >= beta) stop("Initial capital is too small.")
       theta <- beta/(alpha*R)*((beta/(beta-R))^alpha-1)-1
    list(LundbergExp=R,initialCapital=U0,safetyLoading=theta,ruinProb = eps)

Try the RcmdrPlugin.RiskDemo package in your browser

Any scripts or data that you put into this service are public.

RcmdrPlugin.RiskDemo documentation built on Nov. 13, 2023, 5:07 p.m.