Computing yields
Recall that .
If we want to find the yield, we can change our problem to solve for DFs.
Our problem becomes a linear problem, which is much easier to work with.
Now, assume that we have two bonds with two periods paying different cash flows. What's the term structure?
Assune that bond A has the following value
while B
Note that we assume that we know the prices.
We have two unknowns and and two equations (one for each bond). Generally, we can solve this problem using algebra. However, given that you must deal with a number of securities, it is better to work with matrices. Basically, we are going to put unknowns in one side, and constants (prices) in other.
The matrix representation of our problem is
$
\text{or} \quad A x =b $
where the matrix contains the coefficients associated to the unknowns and contains the constants.
We can do row (column) manipulation and find the solution for . Here, we take a shortcut and pre-multiply for the inverse of matrix A.
We are going to ask R to solve this for us. We only need to enter the matrix A and B. In our simple case, A is , or 2 rows and 2 colums and is or 2 rows and 1 column.
Yields
Note that assuming constant interest rates (yields!) is then, is and so on...
Finding the yield becomes to solve for a polynomial of degree .
Once again, we will ask R to do it for us.