# disc2rate

Interest rates from cash flow discounting factors

## Syntax

``Rates = disc2rate(Compounding,Disc,EndTimes,StartTimes)``
``[Rates,EndTimes,StartTimes] = disc2rate(Compounding,Disc,EndTimes,StartTimes,ValuationDate,Basis,EndMonthRule)``

## Description

example

````Rates = disc2rate(Compounding,Disc,EndTimes,StartTimes)` computes interest rates from discount factors where interval points are input as times in periodic units. `disc2rate` computes the yields over a series of `NPOINTS` time intervals given the cash flow discounts 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 or a forward curve.The output `Rates` is an `NPOINTS`-by-`NCURVES` column vector of yields in decimal form over the `NPOINTS` time intervals.```

example

````[Rates,EndTimes,StartTimes] = disc2rate(Compounding,Disc,EndTimes,StartTimes,ValuationDate,Basis,EndMonthRule)` computes interest rates from discount factors where `ValuationDate` is passed and interval points are input as dates. You can specify the investment intervals either with input times or with input dates. Entering `ValuationDate` invokes the date interpretation; omitting `ValuationDate` invokes the default time interpretations.```

## Examples

collapse all

This example shows the two uses of `disc2rate`.

Interval Points Are Input as Times in Periodic Units

Compute rates from a zero curve at 6 months, 12 months, and 24 months, given the discount factors for these periods. The times to the cash flows are `1`, `2`, and `4`. `disc2rate` assumes that the valuation date corresponds to time = 0.

```Compounding = 2; Disc = [0.9756; 0.9426; 0.8799]; EndTimes = [1; 2; 4]; Rates = disc2rate(Compounding, Disc, EndTimes)```
```Rates = 3×1 0.0500 0.0600 0.0650 ```

Interval Points Are Input as Dates

Compute rates from a zero curve at 6 months, 12 months, and 24 months, given the discount factors for these periods. Use dates to specify the ending time horizon.

```Compounding = 2; Disc = [0.9756; 0.9426; 0.8799]; EndDates = ['10/15/97'; '04/15/98'; '04/15/99']; ValuationDate = '4/15/97'; Rates = disc2rate(Compounding, Disc, EndDates, [], ValuationDate)```
```Rates = 3×1 0.0500 0.0600 0.0650 ```

## Input Arguments

collapse all

Compounding rate for which the input zero rates are compounded when annualized, specified as one of the following scalar integers. Compounding determines the formula for the discount factors (`Disc`):

• If `Compounding` = `0` for simple interest:

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

• If `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.

• If `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.

• If `Compounding` = `-1`:

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

Data Types: `double`

Discounts, specified as a number of points `(NPOINTS)` by number of curves (`NCURVES`) matrix of discounts. `Disc` are unit bond prices over investment intervals from `StartTimes`, when the cash flow is valued, to `EndTimes`, when the cash flow is received.

Data Types: `double`

End times, specified as a scalar or an `NPOINTS`-by-`1` column vector of times in periodic units ending the interval to discount over. When `EndTimes` is not a date, the value for `EndTimes` is `T` computed from SIA semi-annual time factors, `Tsemi`, by the formula `T = Tsemi/2 * F`, where `F` is the compounding frequency. `F` is set to `1` for continuous compounding.

Note

When `ValuationDate` is not passed, `EndTimes` is interpreted as times. If `Compounding` = `365` (daily), `EndTimes` is measured in days.

Data Types: `double` | `char`

Start times, specified a scalar or an `NPOINTS`-by-`1` column vector of times in periodic units starting the interval to discount over. `StartDates` must be earlier than `EndDates`. When `StarTimes` is not a date, the value for `StartTimes` is `T` computed from SIA semi-annual time factors, `Tsemi`, by the formula `T = Tsemi/2 * F`, where `F` is the compounding frequency. `F` is set to `1` for continuous compounding.

Note

When `ValuationDate` is not passed, `StartTimes` is interpreted as times. If `Compounding` = `365` (daily), `StartTimes` is measured in days.

Data Types: `double` | `char`

Observation date of the investment horizons entered in `StartTimes` and `EndTimes`, specified as scalar date.

Note

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

Data Types: `double` | `char`

Day-count basis of the instrument when using dates for `StartTimes` and `EndTimes`, specified as a scalar or an `NINST`-by-`1` vector of integers..

• 0 = actual/actual

• 1 = 30/360 (SIA)

• 2 = actual/360

• 3 = actual/365

• 4 = 30/360 (PSA)

• 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

Data Types: `double`

End-of-month rule flag when using dates for `StartTimes` and `EndTimes`, specified as a scalar or an `NINST`-by-`1` vector of nonnegative integers. 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 coupon payment date is always the same numerical day of the month.

• `1` = Set rule on, meaning that a bond coupon payment date is always the last actual day of the month.

Data Types: `double`

## Output Arguments

collapse all

Rates, returned as an `NPOINTS`-by-`NCURVES` column vector of in decimal form over `NPOINTS` time intervals.

Times ending the interval to discount over, returned as an `NPOINTS`-by-`1` column vector, measured in periodic units.

Times starting the interval to discount over, returned as an `NPOINTS`-by-`1` column vector, measured in periodic units.

## Version History

Introduced before R2006a