Language Reference


SPOT Function

SPOT (times, forward_rates);

The SPOT function returns an $n \times 1$ vector of (per-period) spot rates, given vectors of forward rates and times.

The arguments to the SPOT function are as follows:

times

is an $n \times 1$ column vector of times in consistent units. Elements should be nonnegative.

forward_rates

is an $n \times 1$ column vector of corresponding (per-period) forward rates. Elements should be positive.

The SPOT function transforms the given spot rates as

\[ s_1=f_1 \]
\[ s_ i = \left( \Pi _{j=1}^{j=i}(1+f_ j)^{t_ j - t_{j-1}} \right)^{\frac{1}{t_ i}} -1; \quad i=2,\ldots ,n \]

where, by convention, $t_0=0$.

For example, the following statements produce the output shown in FigureĀ 25.391:

time = T(do(1, 5, 1));
forward = T(do(0.05, 0.09, 0.01));
spot = spot(time, forward);
print spot;

Figure 25.391: Spot Rates

spot
0.05
0.0549882
0.0599686
0.0649413
0.0699065