Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Introduction to R for Quantitative Finance

You're reading from  Introduction to R for Quantitative Finance

Product type Book
Published in Nov 2013
Publisher Packt
ISBN-13 9781783280933
Pages 164 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

Introduction to R for Quantitative Finance
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Time Series Analysis Portfolio Optimization Asset Pricing Models Fixed Income Securities Estimating the Term Structure of Interest Rates Derivatives Pricing Credit Risk Management Extreme Value Theory Financial Networks References Index

Chapter 5. Estimating the Term Structure of Interest Rates

In the previous chapter we discussed how changes in the level of interest rates, the term structure, affect the prices of fixed income securities. Now we focus on the estimation of the term structure of interest rates, which is a fundamental concept in finance. It is an important input in almost all financial decisions. This chapter will introduce term structure estimation methods by cubic spline regression, and it will demonstrate how one can estimate the term structure of interest rates using the termstrc package and the govbonds dataset.

The term structure of interest rates and related functions


A t-year zero-coupon bond with a face value of 1 USD is a security that pays 1 USD at maturity, that is, in t years time. Let denote its market value, which is also called the t-year discount factor. The function is called the discount function. Based on the no-arbitrage assumption, it is usually assumed that , is monotonically decreasing, and that . It is also usually assumed that is twice continuously differentiable.

Let denote the continuously compounded annual return of the t-year zero coupon bond; it shall be defined as:

The function is called the (zero coupon) yield curve.

Let denote the instantaneous forward rate curve or simply the forward rate curve, where:

Here is the interest rate agreed upon by two parties in a hypothetical forward loan agreement, in which one of the parties commits to lend an amount to the other party in t years time for a very short term and at an interest rate that is fixed when the contract is...

The estimation problem


We cannot observe the term structure directly, but we can observe the market prices of instruments whose price depends on the term structure and thus estimate the term structure. A good source of information regarding the term structure is the government bond market, where usually a lot of liquid securities are traded whose prices depend solely on the term structure.

Suppose there are n bonds traded whose gross (or dirty) prices are denoted by . There are m dates when at least one bond's owners receive a payment. These payments are due in years time respectively where . The matrix C contains the cash flows of the bonds. We model bond prices as the sum of the present value of the bond's cash flow and a normally distributed error term:

Here d is the vector containing the discount factors and is a vector containing the error terms. The observed market price of a bond can differ from the present value of the cash flow for two reasons: there might be a measurement error...

Estimation of the term structure by linear regression


Suppose that the discount function can be expressed as the linear combination of the functions that are twice continuously differentiable functions as

where

We can estimate the weights by generalized least squares. We will discuss the choice of the functions later. The estimated discount function is the function of the estimated weights .

Let D denote an matrix whose elements are , and be the vector that contains the weights . Thus and

which is a linear regression model under the constraint that , which can be expressed as follows:

where .

The GLS estimation for the weights of equation (2) under the constraint of equation (3) is

where

Cubic spline regression


We need to choose the functions carefully if we want the estimation to yield a reasonably estimated discount function. The typical discount function is nonlinear. It is a monotonically decreasing function and converges to zero asymptotically at infinity. Thus, fitting a straight line is not a good idea. One can try to fit a higher order polynomial to the discount function. This is not a satisfactory solution either. If we fit low-order polynomials, they are usually not flexible enough and don't fit well, especially at the short-term maturities. If we fit high-order polynomials, they may fit well but tend to produce wild swings at long-term maturities where relatively few bonds mature. These wild swings usually result in unrealistic term structure estimates.

Spline functions are functions that help solve this problem as their flexibility can be increased locally where needed, without raising the polynomial order of the estimated function. Estimating the term structure...

Applied R functions


Although we have already used some functions from the termstrc package in the previous example to demonstrate how one can determine the ideal number of knot points and also specify those, this process can be done in an easier manner with some further R functions, as shown in the following command lines:

> x <- estim_cs(govbonds, 'GERMANY')
> x$knotpoints[[1]]
       DE0001135101 DE0001141463 DE0001135218 DE0001135317              
0.0000     1.006027     2.380274     5.033425     9.234521 31.44657

First we used the estim_cs function that estimates the term structure of coupon bonds based on cubic splines (Ferstl-Haydn, 2010) and returns the knot points in a list with the knotpoints name. Please note that estim_cs works with a list—just like most functions in the package—that's why x$knotpoints returned a list from which we checked only the first element that was identical to the values we computed manually in the preceding section.

There are a bunch of other useful...

Summary


In this chapter, we discussed term structure estimation methods by cubic spline regression and also demonstrated how one can estimate the term structure of interest rates in R. After a brief theoretical introduction to term structure and interest rates, also discussing the most basic methods such as a linear regression model and related problems, the chapter gave a detailed overview of an R implementation of cubic spline regression model and also mentioned already published R functions and packages for such tasks with more complex expectations.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Introduction to R for Quantitative Finance
Published in: Nov 2013 Publisher: Packt ISBN-13: 9781783280933
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}