Continuation of Insurance Risk Exercise, Pareto II Loss Distribution
Stopping Simulation When Standard Error is Sufficiently Small
Instead of generating a fixed size sample of simulated data, we want to set the sample size by calculating the standard error of the estimator after each iteration, and ending the simulation when the standard error is smaller than some preset criterion value.
In the insurance risk example, we are estimating a probability, p. Hence, for a sample of size K, the standard error of the estimator is p1-pK. We will revise the simulation program to recalculate both the probability estimate and the standard error, and stop the simulation when the standard error becomes smaller than a criterion value d.
The revised program is shown below. Note that, instead of inputting a fixed sample size, we input a criterion value for the standard error. Note also that we revise the formula for calculating the proportion, since we must recalculate it at each iteration according to the current sample size. In addition, we run 100 iterations before we start checking the stopping criterion.
Assume the following input:
Initial capital = $100,000.00
Length of accounting period = 365. days
Initial pool size = 10,000
Premium rate per customer = $1.15 per day
Customer acquisition rate = 0.1 per day, on average
Customer loss rate = 0.05 per day, on average
Claim rate (per customer) = 0.0005 per day, on average
(Pareto II) Loss distribution parameters: α=1.88047 and β=1872.131756.
Stopping criterion for standard error = 0.005
Then, with an initial seed value of 1979, we obtain:
The estimated probability is 0.9704.
The sample size is 1149.
The estimated standard error is 0.004999.
If we change our stopping criterion to 0.003, then, with the same initial seed value, we obtain:
The estimated probability it 0.9711.
The sample size is 3117.
The estimated standard error is 0.002999.
If we change our stopping criterion to 0.002, then, with the same initial seed value, we obtain:
The estimated probability it 0.9713.
The sample size is 6969.
The estimated standard error is 0.002000.
Note that sample size is rather sensitive to the stopping criterion value.
PROGRAM INSURANCE
INTEGER N0, ISEED, K, L
REAL MU, NU, LAMBDA, TMAX, A0, C, ALPHA, BETA
REAL RK, INDIC(20000), PROP, VARP, SDP, D, RL
PRINT*, 'Input initial capital.'
READ*, A0
PRINT*, 'Input length of accounting period.'
READ*, TMAX
PRINT*, 'Input initial pool size.'
READ*, N0
PRINT*, 'Input policy income (premium) rate (per customer).'
READ*, C
PRINT*, 'Input customer acquisition rate.'
READ*, NU
PRINT*, 'Input customer loss rate.'
READ*, MU
PRINT*, 'Input claim rate.'
READ*, LAMBDA
PRINT*, 'Input Loss distribution parameter(s).'
READ*, ALPHA, BETA
PRINT*, 'Input initial seed value.'
READ*, ISEED
PRINT*, 'Input stopping criterion (d).'
READ*, D
DO L = 1, 20000
INDIC(L) = 1.
ENDDO
PROP = 0.
L = 1
15 INDIC(L) = RINSURE(A0,N0,C,NU,MU,LAMBDA,ALPHA, BETA,TMAX,ISEED)
RL = L
PROP = (((RL-1.)/RL)*PROP) + (INDIC(L)/RL)
VARP = (PROP*(1-PROP))/RL
SDP = SQRT(VARP)
IF (RL .GT. 100. .AND. SDP .LT. D) GO TO 20
L = L + 1
IF (L .GT. 20000) THEN
PRINT*, 'Sample size too large.'
STOP
ELSE
GO TO 15
END IF
20 PRINT*, 'The estimated probability is ', PROP, '.'
PRINT*, 'The sample size is ', L, '.'
PRINT*, 'The estimated standard error is ', SDP
END
REAL FUNCTION RINSURE(A0,N0,C,NU,MU,LAMBDA,ALPHA, BETA,TMAX,ISEED)
REAL A, EXPPAR, P1, P2, X, TE, T, Y, U, LAMBDA, MU, NU
INTEGER N, ISEED
RINSURE = 1.
T = 0.
A = A0
N = N0
EXPPAR = NU + (N*MU) + (N*LAMBDA)
P1 = NU/EXPPAR
P2 = (NU + (N*MU))/EXPPAR
X = EXPON(ISEED, EXPPAR)
TE = X
10 IF (TE .GT. TMAX) THEN
RETURN
ELSE IF (TE .LE. TMAX) THEN
A = A + (N*C*(TE - T))
T = TE
U = RAN2(ISEED)
IF (U .LT. NU/EXPPAR) THEN
N = N + 1
ELSE IF (P1 .LE. U .AND. U .LT. P2) THEN
N = N - 1
ELSE
Y = PARETO(ISEED,ALPHA,BETA)
IF (Y .GT. A) THEN
RINSURE = 0.
RETURN
ELSE IF (Y .LE. A) THEN
A = A - Y
END IF
END IF
EXPPAR = NU + (N*MU) + (N*LAMBDA)
P1 = NU/EXPPAR
P2 = (NU + (N*MU))/EXPPAR
X = EXPON(ISEED,EXPPAR)
TE = T + X
GO TO 10
END IF
RETURN
END
REAL FUNCTION PARETO(ISEED,ALPHA,BETA)
U = RAN2(ISEED)
AINV = 1./ALPHA
PARETO = BETA*((1/(U**AINV))-1.)
RETURN
END
REAL FUNCTION EXPON(ISEED,RATE)
U = RAN2(ISEED)
EXPON = -LOG(U)/RATE
RETURN
END
REAL FUNCTION RAN2(IDUM)
PARAMETER (M=714025,IA=1366,IC=150889,RM=1.4005112E-6)
DATA IFF /0/
DIMENSION IR(97)
IY = 0
IF(IDUM .LT. 0. .OR. IFF .EQ. 0)THEN
IFF=1
IDUM=MOD(IC-IDUM,M)
DO 11 J=1,97
IDUM=MOD(IA*IDUM+IC,M)
IR(J)=IDUM
11 CONTINUE
IDUM=MOD(IA*IDUM+IC,M)
IY=IDUM
ENDIF
J=1+(97*IY)/M
IF(J .GT. 97 .OR. J .LT. 1)PAUSE
IY=IR(J)
RAN2=IY*RM
IDUM=MOD(IA*IDUM+IC,M)
IR(J)=IDUM
RETURN
END