Fit smoothing spline to bond market data
CurveObj = IRFunctionCurve.fitSmoothingSpline(Type, Settle,
Instruments, Lambdafun) CurveObj = IRFunctionCurve.fitSmoothingSpline(Type, Settle,
Instruments, Lambdafun, 'Parameter1', Value1, 'Parameter2',
You must have a license for Curve Fitting Toolbox™ software
to use the
Type of interest-rate curve for a bond:
Scalar for the
Penalty function that takes as its input time and returns a penalty value. Use a function handle to support the penalty function. The function handle for the penalty function which takes one numeric input (time-to-maturity) and returns one numeric output (penalty to be applied to the curvature of the spline). For more information on defining a function handle, see the MATLAB® Programming Fundamentals documentation.
(Optional) Vector of knot locations (times-to-maturity);
by default, knots is set to be a vector comprised of
(Optional) Scalar that sets the compounding frequency
per year for the
(Optional) Day-count basis of the interest-rate curve. A scalar of integers.
For more information, see basis.
For each bond
Instrument, you can specify
the following additional instrument parameters as parameter/value
pairs. For example,
a bond instrument's
Basis value from the curve's
(Optional) Coupons per year of the bond. A vector of integers. Allowed values are 0, 1, 2 (default), 3, 4, 6, and 12.
(Optional) Day-count basis of the bond. A vector of integers.
For more information, see basis.
(Optional) End-of-month rule. A vector. This rule applies
(Optional) Date when an instrument was issued.
(Optional) Date when a bond makes its first coupon payment;
used when bond has an irregular first coupon period. When
(Optional) Last coupon date of a bond before the maturity
date; used when bond has an irregular last coupon period. In the absence
of a specified
(Optional) Face or par value. Default =
Fcurve = IRFunctionCurve.fitSmoothingSpline(Type, Settle,
Instruments, Lambdafun, 'Parameter1', Value1, 'Parameter2', Value2,
...) fits a smoothing spline to market data for a bond.
You must enter the optional arguments for
Knots as parameter/value pairs.
This example shows how to use a smoothing spline function to fit market data for a bond.
Settle = repmat(datenum('30-Apr-2008'),[6 1]); Maturity = [datenum('07-Mar-2009');datenum('07-Mar-2011');... datenum('07-Mar-2013');datenum('07-Sep-2016');... datenum('07-Mar-2025');datenum('07-Mar-2036')]; CleanPrice = [100.1;100.1;100.8;96.6;103.3;96.3]; CouponRate = [0.0400;0.0425;0.0450;0.0400;0.0500;0.0425]; Instruments = [Settle Maturity CleanPrice CouponRate]; PlottingPoints = datenum('07-Mar-2009'):180:datenum('07-Mar-2036'); Yield = bndyield(CleanPrice,CouponRate,Settle,Maturity); % use the AUGKNT function to construct the knots for a cubic spline at every 5 years CustomKnots = augknt(0:5:30,4); SmoothingModel = IRFunctionCurve.fitSmoothingSpline('Zero',datenum('30-Apr-2008'),... Instruments,@(t) 1000,'knots', CustomKnots); % create the plot plot(PlottingPoints, getParYields(SmoothingModel, PlottingPoints),'b') hold on scatter(Maturity,Yield,'black') datetick('x')
The term structure can be modeled with a spline — specifically, one way to model the term structure is by representing the forward curve with a cubic spline. To ensure that the spline is sufficiently smooth, a penalty is imposed relating to the curvature (second derivative) of the spline:
where the first term is the difference between the observed price P and the predicted price, , (weighted by the bond's duration, D) summed over all bonds in our data set and the second term is the penalty term (where λ is a penalty function and f is the spline).
See , ,  below.
There have been different proposals for the specification of the penalty function λ. One approach, advocated by , and currently used by the UK Debt Management Office, is a penalty function of the following form:
 Nelson, C.R., Siegel, A.F., (1987), Parsimonious modelling of yield curves, Journal of Business, 60, pp 473-89.
 Svensson, L.E.O. (1994), Estimating and interpreting forward interest rates: Sweden 1992-4, International Monetary Fund, IMF Working Paper, 1994/114.
 Fisher, M., Nychka, D., Zervos, D. (1995), Fitting the term structure of interest rates with smoothing splines, Board of Governors of the Federal Reserve System, Federal Reserve Board Working Paper 95-1.
 Anderson, N., Sleath, J. (1999), New estimates of the UK real and nominal yield curves, Bank of England Quarterly Bulletin, November, pp 384–92.
 Waggoner, D. (1997), Spline Methods for Extracting Interest Rate Curves from Coupon Bond Prices, Federal Reserve Board Working Paper 97–10.
 Zero-coupon yield curves: technical documentation, BIS Papers No. 25, October 2005.
 Bolder, D.J., Gusba,S (2002), Exponentials, Polynomials, and Fourier Series: More Yield Curve Modelling at the Bank of Canada, Working Papers 02–29, Bank of Canada.
 Bolder, D.J., Streliski, D (1999), Yield Curve Modelling at the Bank of Canada, Technical Reports 84, Bank of Canada.