Friday, 22 November 2013

Annuities

Yearly Annuities

An annuity provides a regular amount at defined periods. We first consider an amount payable yearly for the whole of life. If this is paid in advance then it is the sum of the following series:

 This is referred to as the annuity due. The annuity in arrears has exactly the same formula but excluding the initial payment of 1.

This can be easily handled using a recursive approach very similar to that used for A.

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
open System.Collections.Generic
/// memoized version of annuity due
let rec mem_ladx = memoize (fun x ->
    // calculate components
    let px = book_px x
    let v = 1.0/1.05
    //calculate result
    if x<129.0 then 1.0 + v*px*mem_ladx(x+1.0) else 1.0)

Quarterly Annuities

Quarterly annuities can be calculated in a very similar way, but making payments of a 1/4 each quarter and also applying the discount factors quarterly. We thus obtain a very similar set of code:

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
open System.Collections.Generic
/// memoized version of annuity due quarterly
let rec mem_ladx4 = memoize (fun x ->
    // calculate components
    let px4 = book_px4 x
    let v4 = (1.0/1.05)**(1.0/4.0)
    //calculate result
    if x<129.0 then 0.25 + v4*px4*mem_ladx4(x+0.25) else 1.0)

We can similarly calculate the quarterly annuity in arrears by simply deducting 0.25 from the quarterly annuity due. We can then use FCell to calculate some sample results in Excel:

These are the same values as page 122 of the book.

No comments:

Post a Comment