Previous Page | Next Page

 Language Reference

## RATES Function

calculates a column vector of (per-period, such as per-year) interest rates converted from one base to another

RATES( rates,oldfreq,newfreq)

The RATES function returns an vector of interest rates converted from one base to another.

rates
is an column vector of rates corresponding to the old base. Elements should be positive.
oldfreq
is a scalar that represents the old base. If positive, it represents discrete compounding as the reciprocal of the number of compoundings per period. If zero, it represents continuous compounding. If -1, the rates represent discount factors. No other negative values are accepted.
newfreq
is a scalar that represents the new base. If positive, it represents discrete compounding as the reciprocal of the number of compoundings per period. If zero, it represents continuous compounding. If -1, the rates represent discount factors. No other negative values are accepted.

Let be the discount function, which is the present value of a unit amount to be received periods from now. The discount function can be expressed in three different ways:

with per-period discount factors :
with continuous compounding:
with discrete compounding:
where is the frequency, the reciprocal of the number of compoundings per period. The RATES function converts between these three representations.

For example, the following code uses the RATES function:

```
rates=T(do(0.1,0.3,0.1));
oldfreq=0;
newfreq=0;
rates=rates(rates,oldfreq,newfreq);
print rates;
```

The output is as follows:

```
RATES
0.1
0.2
0.3
```

 Previous Page | Next Page | Top of Page