Home Forums SOA Exams 9 standard algorithms for life contingencies

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #9250
    Richard Purvey
    Participant

      Computer Algorithms For Nine Of The Standard Algorithmic Calculations Currently Included In The Actuarial Life Contingencies Syllabus

      In each case, make the first line of the algorithm:

      10 DEF FNS(U)=whatever the survival function, S(U), is.

      For example, for a Makeham with A equal to 0.00022, B equal to 2.7*10^(-6) and c equal to 1.124, make the first line of the algorithm:

      10 DEF FNS(U)=EXP(-0.00022*U-2.7*10^(-6)*(1.124^U-1)/LN(1.124))

      And then;

      If you want the algorithm to calculate an n-year temporary curtate life expectancy for (x) when executed then add on the following:

      20 INPUT x,n

      30 ANSWER=0

      40 FOR r=1 TO n

      50 ANSWER=ANSWER+FNS(x+r)

      60 NEXT r

      70 ANSWER=ANSWER/FNS(x)

      80 PRINT ANSWER

      90 END

      Or if you want the algorithm to calculate the actuarial present value of an n-year temporary immediate life annuity, with a discount factor of v, of 1 per year payable once a year for (x) when executed then add on the following:

      20 INPUT x,n,v

      30 ANSWER=0

      40 FOR r=1 TO n

      50 ANSWER=ANSWER+v^r*FNS(x+r)

      60 NEXT r

      70 ANSWER=ANSWER/FNS(x)

      80 PRINT ANSWER

      90 END

      Or if you want the algorithm to calculate the actuarial present value of an n-year temporary life annuity due, with a discount factor of v, of 1 per year payable once a year for (x) when executed then add on the following:

      20 INPUT x,n,v

      30 ANSWER=0

      40 FOR r=0 TO n-1

      50 ANSWER=ANSWER+v^r*FNS(x+r)

      60 NEXT r

      70 ANSWER=ANSWER/FNS(x)

      80 PRINT ANSWER

      90 END

      Or if you want the algorithm to calculate the actuarial present value of a death benefit, with a discount factor of v, of 1 payable at the end of the year of death for (x), provided this occurs within n years, when executed then add on the following:

      20 INPUT x,n,v

      30 ANSWER=0

      40 FOR r=0 TO n-1

      50 ANSWER=ANSWER+v^r*FNS(x+r)

      60 NEXT r

      70 ANSWER=ANSWER/FNS(x)

      80 ANSWER=1-v^n*FNS(x+n)/FNS(x)-(1-v)*ANSWER

      90 PRINT ANSWER

      100 END

      Or if you want the algorithm to calculate the actuarial present value of an endowment insurance, with a discount factor of v, of 1 where the death benefit is payable at the end of the year of death for (x), provided this occurs within n years, when executed then add on the following:

      20 INPUT x,n,v

      30 ANSWER=0

      40 FOR r=0 TO n-1

      50 ANSWER=ANSWER+v^r*FNS(x+r)

      60 NEXT r

      70 ANSWER=ANSWER/FNS(x)

      80 ANSWER=1-(1-v)*ANSWER

      90 PRINT ANSWER

      100 END

      Or if you want the algorithm to calculate the actuarial present value of an n-year temporary immediate life annuity, with a discount factor of v, of 1 per year payable m times per year for (x) when executed then add on the following:

      20 INPUT x,n,m,v

      30 ANSWER=0

      40 FOR r=1 TO m*n

      50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)

      60 NEXT r

      70 ANSWER=ANSWER/(m*FNS(x))

      80 PRINT ANSWER

      90 END

      Or if you want the algorithm to calculate the actuarial present value of an n-year temporary life annuity due, with a discount factor of v, of 1 per year payable m times per year for (x) when executed then add on the following:

      20 INPUT x,n,m,v

      30 ANSWER=0

      40 FOR r=0 TO m*n-1

      50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)

      60 NEXT r

      70 ANSWER=ANSWER/(m*FNS(x))

      80 PRINT ANSWER

      90 END

      Or if you want the algorithm to calculate the actuarial present value of a death benefit, with a discount factor of v, of 1 payable at the end of the 1/m year of death for (x), provided this occurs within n years, when executed then add on the following:

      20 INPUT x,n,m,v

      30 ANSWER=0

      40 FOR r=0 TO m*n-1

      50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)

      60 NEXT r

      70 ANSWER=ANSWER/(m*FNS(x))

      80 ANSWER=1-v^n*FNS(x+n)/FNS(x)-m*(1-v^(1/m))*ANSWER

      90 PRINT ANSWER

      100 END

      Or if you want the algorithm to calculate the actuarial present value of an endowment insurance, with a discount factor of v, of 1 where the death benefit is payable at the end of the 1/m year of death for (x), provided this occurs within n years, when executed then add on the following:

      20 INPUT x,n,m,v

      30 ANSWER=0

      40 FOR r=0 TO m*n-1

      50 ANSWER=ANSWER+v^(r/m)*FNS(x+r/m)

      60 NEXT r

      70 ANSWER=ANSWER/(m*FNS(x))

      80 ANSWER=1-m*(1-v^(1/m))*ANSWER

      90 PRINT ANSWER

      100 END

      I have written the above algorithms in BBC BASIC.

      Richard Purvey, February 2022.

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.