Implementing Panjer’s Recurrence Formula to Calculate the Exact Distribution of S The following SAS program implements Panjer’s Recurrence Formula to calculate the exact distribution for the total claim value for a compound Poisson distribution with a given Poisson parameter value and a loss distribution given as a set of probabilities for loss amounts taking on positive integer values. With suitable modification, the program may also be used to calculate the exact distribution for the total claim value for a compound binomial distribution. The example implemented here is Example 3.6 on page 89 of the textbook. The SAS program is listed first, followed by the results (which are given using “put” statements and appear in the SAS log of the program. Note that both the p.m.f. and the c.d.f. of the distribution of S are given. SAS Program: data one; input lambda; dummy = 1; put "The Poisson parameter is " lambda "."; cards; 3 ; data two; array x{9} x1-x9; array y{9} y1-y9; array fx{9} fx1-fx9; lossunit = 100; do i = 1 to 9; input y(i); end; put "P.M.F. for the Loss Distribution"; do i = 1 to 9; fx(i) = 1/9; x(i) = y(i)/lossunit; put "For x = " y(i) ", f(x) = " fx(i); end; dummy = 1; cards; 100 200 300 400 500 600 700 800 900 ; data three;merge one two; by dummy; array s{31} s1-s31; array fs{31} fs1 - fs31; array CDFs{31} CDFs1 - CDFs31; array fx{9} fx1-fx9; put "The units of measurement for the loss distribution: " lossunit "."; fn0 = exp(-lambda); s(1) = 0; fs(1) = fn0; do i = 2 to 31; fs(i) = 0; end; do i = 2 to 31; k = min(i-1, 9); do j = 1 to k; fs(i) = fs(i) + (lambda*j/(i-1))*fx(j)*fs(i-j); end; s(i) = (i-1)*lossunit; end; CDFs(1) = fs(1); do i = 2 to 31; CDFs(i) = CDFs(i-1)+fs(i); end; put "Distribution of S, including p.m.f. and c.d.f."; do i = 1 to 31; put "For s = " s(i) ", fs = " fs(i) ", and Fs = " CDFs(i) "."; end; drop dummy x1-x9 fx1-fx9 lossunit; ; run; Results: NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.4 (TS1M0) Licensed to UNIVERSITY OF NORTH FLORIDA - SFA T&R, Site 70080095. NOTE: This session is executing on the X64_7PRO platform. NOTE: Updated analytical products: SAS/STAT 12.3 (maintenance) SAS/ETS 12.3 (maintenance) SAS/OR 12.3 (maintenance) SAS/IML 12.3 (maintenance) SAS/QC 12.3 (maintenance) NOTE: Additional host information: X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation NOTE: SAS initialization used: real time 0.60 seconds cpu time 0.51 seconds 1 2 3 4 5 data one; input lambda; dummy = 1; put "The Poisson parameter is " lambda "."; cards; The Poisson parameter is 3 . NOTE: The data set WORK.ONE has 1 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ; data two; array x{9} x1-x9; array y{9} y1-y9; array fx{9} fx1-fx9; lossunit = 100; do i = 1 to 9; input y(i); end; put "P.M.F. for the Loss Distribution"; do i = 1 to 9; fx(i) = 1/9; x(i) = y(i)/lossunit; put "For x = " y(i) ", f(x) = " fx(i); end; dummy = 1; cards; P.M.F. for the Loss Distribution For x = 100 , f(x) = 0.1111111111 For x = 200 , f(x) = 0.1111111111 For x = 300 , f(x) = 0.1111111111 For x = 400 , f(x) = 0.1111111111 For x = 500 , f(x) = 0.1111111111 For x = 600 , f(x) = 0.1111111111 For x = 700 , f(x) = 0.1111111111 For x = 800 , f(x) = 0.1111111111 For x = 900 , f(x) = 0.1111111111 NOTE: The data set WORK.TWO has 1 observations and 30 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ; data three;merge one two; by dummy; array s{31} s1-s31; array fs{31} fs1 - fs31; array CDFs{31} CDFs1 - CDFs31; array fx{9} fx1-fx9; put "The units of measurement for the loss distribution: " lossunit "."; fn0 = exp(-lambda); s(1) = 0; fs(1) = fn0; do i = 2 to 31; fs(i) = 0; end; do i = 2 to 31; k = min(i-1, 9); do j = 1 to k; fs(i) = fs(i) + (lambda*j/(i-1))*fx(j)*fs(i-j); end; s(i) = (i-1)*lossunit; end; CDFs(1) = fs(1); do i = 2 to 31; CDFs(i) = CDFs(i-1)+fs(i); end; put "Distribution of S, including p.m.f. and c.d.f."; do i = 1 to 31; put "For s = " s(i) ", fs = " fs(i) ", and Fs = " CDFs(i) "."; end; drop dummy x1-x9 fx1-fx9 lossunit; ; run; The units of measurement for the loss distribution: 100 . Distribution of S, including p.m.f. and c.d.f. For s = 0 , fs = 0.0497870684 , and Fs = 0.0497870684 . For s = 100 , fs = 0.0165956895 , and Fs = 0.0663827578 . For s = 200 , fs = 0.0193616377 , and Fs = 0.0857443955 . For s = 300 , fs = 0.0224349135 , and Fs = 0.108179309 . For s = 400 , fs = 0.0258411276 , and Fs = 0.1340204366 . For s = 500 , fs = 0.0296075978 , and Fs = 0.1636280344 . For s = 600 , fs = 0.0337634445 , and Fs = 0.197391479 . For s = 700 , fs = 0.0383396896 , and Fs = 0.2357311685 . For s = 800 , fs = 0.0433693604 , and Fs = 0.2791005289 . For s = 900 , fs = 0.0488875992 , and Fs = 0.3279881281 . For s = 1000 , fs = 0.0383360874 , and Fs = 0.3663242155 . For s = 1100 , fs = 0.0394140265 , and Fs = 0.4057382421 . For s = 1200 , fs = 0.0401778328 , and Fs = 0.4459160749 . For s = 1300 , fs = 0.0405698597 , and Fs = 0.4864859346 . For s = 1400 , fs = 0.0405266637 , and Fs = 0.5270125983 . For s = 1500 , fs = 0.0399785791 , and Fs = 0.5669911774 . For s = 1600 , fs = 0.0388492658 , and Fs = 0.6058404432 . For s = 1700 , fs = 0.0370552319 , and Fs = 0.6428956751 . For s = 1800 , fs = 0.0345053283 , and Fs = 0.6774010034 . For s = 1900 , fs = 0.0311002142 , and Fs = 0.7085012176 . For s = 2000 , fs = 0.0294977404 , and Fs = 0.7379989581 . For s = 2100 , fs = 0.0277364905 , and Fs = 0.7657354486 . For s = 2200 , fs = 0.0258426937 , and Fs = 0.7915781423 . For s = 2300 , fs = 0.0238490037 , and Fs = 0.815427146 . For s = 2400 , fs = 0.0217952198 , and Fs = 0.8372223658 . For s = 2500 , fs = 0.019729064 , and Fs = 0.8569514298 . For s = 2600 , fs = 0.0177070179 , and Fs = 0.8746584477 . For s = 2700 , fs = 0.0157952233 , and Fs = 0.890453671 . For s = 2800 , fs = 0.01407045 , and Fs = 0.904524121 . For s = 2900 , fs = 0.0126211353 , and Fs = 0.9171452563 . For s = 3000 , fs = 0.0112411712 , and Fs = 0.9283864274 . NOTE: There were 1 observations read from the data set WORK.ONE. NOTE: There were 1 observations read from the data set WORK.TWO. NOTE: The data set WORK.THREE has 1 observations and 107 variables. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.03 seconds