Documentation

# rate2disc

Discount factors from interest rates

## Syntax

```Disc = rate2disc(Compounding,Rates,EndTimes)
Disc = rate2disc(Compounding,Rates,EndTimes,StartTimes)
[Disc,EndTimes,StartTimes] = rate2disc(Compounding,Rates,EndDates,StartDates,ValuationDate)
[Disc,EndTimes,StartTimes] = rate2disc(Compounding,Rates,EndDates,StartDates,ValuationDate,Basis,EndMonthRule)
```

Usage 1: Interval points are input as times in periodic units.

Usage 2: `ValuationDate` is passed and interval points are input as dates.

## Arguments

`Compounding`

Scalar value representing the rate at which the input zero rates were compounded when annualized. This argument determines the formula for the discount factors (`Disc`):

• `Compounding` = `0` for simple interest

• `Disc = 1/(1 + Z * T)`, where `T` is time in years and simple interest assumes annual times ```F = 1```.

• `Compounding` = `1`, `2`, `3`, `4`, `6`, `12`

• `Disc = (1 + Z/F)^(-T)`, where `F` is the compounding frequency, `Z` is the zero rate, and `T` is the time in periodic units, for example, ```T = F``` is one year.

• `Compounding` = `365`

• `Disc = (1 + Z/F)^(-T)`, where `F` is the number of days in the basis year and `T` is a number of days elapsed computed by basis.

• `Compounding` = `-1`

• `Disc = exp(-T*Z)`, where `T` is time in years.

`Rates`

Number of points (`NPOINTS`) by number of curves (`NCURVES`) matrix of rates in decimal form. For example, 5% is 0.05 in `Rates`. `Rates` are the yields over investment intervals from `StartTimes`, when the cash flow is valued, to `EndTimes`, when the cash flow is received.

`EndTimes`

`NPOINTS`-by-`1` vector or scalar of times in periodic units ending the interval to discount over.

### Note

When `ValuationDate` is not passed, the third and fourth arguments (`EndTimes` and `StartTimes`) are interpreted as times.

`StartTimes`

(Optional) `NPOINTS`-by-`1` vector or scalar of times in periodic units starting the interval to discount over. Default = `0`.

`EndDates`

`NPOINTS`-by-`1` vector or scalar of serial maturity dates ending the interval to discount over.

### Note

: When `ValuationDate` is passed, the third and fourth arguments (`EndDates` and `StartDates`) are interpreted as dates. The date `ValuationDate` is used as the zero point for computing the times.

`StartDates`

(Optional) `NPOINTS`-by-`1` vector or scalar of serial dates starting the interval to discount over. `StartDates` must be earlier than `EndDates`.

Default = `ValuationDate`.

`ValuationDate`

Scalar value in serial date number form representing the observation date of the investment horizons entered in `StartDates` and `EndDates`. Required in Usage 2. Omitted or passed as an empty matrix to invoke Usage 1.

`Basis`

(Optional) Day-count basis of the instrument when using Usage 2. A vector of integers.

• 0 = actual/actual (default)

• 1 = 30/360 (SIA)

• 2 = actual/360

• 3 = actual/365

• 4 = 30/360 (BMA)

• 5 = 30/360 (ISDA)

• 6 = 30/360 (European)

• 7 = actual/365 (Japanese)

• 8 = actual/actual (ICMA)

• 9 = actual/360 (ICMA)

• 10 = actual/365 (ICMA)

• 11 = 30/360E (ICMA)

• 12 = actual/365 (ISDA)

• 13 = BUS/252

`EndMonthRule`

(Optional) End-of-month rule when using Usage 2. A vector. This rule applies only when `Maturity` is an end-of-month date for a month having 30 or fewer days. `0` = ignore rule, meaning that a bond's coupon payment date is always the same numerical day of the month. `1` = set rule on (default), meaning that a bond's coupon payment date is always the last actual day of the month.

## Description

Usage 1: `Disc = rate2disc(Compounding,Rates,EndTimes)` or ```Disc = rate2disc(Compounding, Rates,EndTimes,StartTimes)``` where interval points are input as times in periodic units.

Usage 2: ```[Disc,EndTimes,StartTimes] = rate2disc(Compounding,Rates,EndDates,StartDates, ValuationDate)``` or ```[Disc,EndTimes,StartTimes] = rate2disc(Compounding,Rates,EndDates,StartDates,ValuationDate,Basis, EndMonthRule)``` where `ValuationDate` is passed and interval points are input as dates.

`rate2disc` computes the discounts over a series of `NPOINTS` time intervals given the annualized yield over those intervals. `NCURVES` different rate curves can be translated at once if they have the same time structure. The time intervals can represent a zero curve or a forward curve.

The output `Disc` is an `NPOINTS`-by-`NCURVES` column vector of discount factors in decimal form representing the value at time `StartTime` of a unit cash flow received at time `EndTime`.

You can specify the investment intervals either with input times (Usage 1) or with input dates (Usage 2). Entering `ValuationDate` invokes the date interpretation; omitting `ValuationDate` invokes the default time interpretations.

For Usage 1:

• `StartTimes` is an `NPOINTS-`by-`1` column vector of times starting the interval to discount over, measured in periodic units.

• `EndTimes` is an `NPOINTS-`by-`1` column vector of times ending the interval to discount over, measured in periodic units.

For Usage 2:

• `StartDates` is an `NPOINTS-`by-`1` column vector of serial dates starting the interval to discount over, measured in days.

• `EndDates` is an `NPOINTS-`by-`1` column vector of serial dates ending the interval to discount over, measured in days.

If `Compounding = 365` (daily), `StartDates` and `EndDates` are measured in days as in Usage 2. Otherwise, in Usage 1, the arguments contain values, `T`, computed from SIA semiannual time factors, `Tsemi`, by the formula `T = Tsemi/2*F`, where `F` is the compounding frequency.

## Examples

Example 1 demonstrates Usage 1. Compute discounts from a zero curve at 6 months, 12 months, and 24 months. The times to the cash flows are 1, 2, and 4. You are computing the present value (at time 0) of the cash flows.

```Compounding = 2; Rates = [0.05; 0.06; 0.065]; EndTimes = [1; 2; 4]; Disc = rate2disc(Compounding, Rates, EndTimes)```
```Disc = 0.9756 0.9426 0.8799 ```

Example 2 demonstrates Usage 2. Compute discounts from a zero curve at 6 months, 12 months, and 24 months. Use dates to specify the ending time horizon.

```Compounding = 2; Rates = [0.05; 0.06; 0.065]; EndDates = ['10/15/97'; '04/15/98'; '04/15/99']; ValuationDate = '4/15/97'; Disc = rate2disc(Compounding, Rates, EndDates, [], ValuationDate)```
```Disc = 0.9756 0.9426 0.8799 ```

Example 3 demonstrates Usage 1. Compute discounts from the 1-year forward rates beginning now, in six months, and in 12 months. Use monthly compounding. The times to the cash flows are 12, 18, 24, and the forward times are 0, 6, 12.

```Compounding = 12; Rates = [0.05; 0.04; 0.06]; EndTimes = [12; 18; 24]; StartTimes = [0; 6; 12]; Disc = rate2disc(Compounding, Rates, EndTimes, StartTimes) ```
```Disc = 0.9513 0.9609 0.9419 ```