| Contents | Index |
CurveObj = IRFunctionCurve.fitSmoothingSpline(Type, Settle, Instruments, Lambdafun) CurveObj = IRFunctionCurve.fitSmoothingSpline(Type, Settle, Instruments, Lambdafun, 'Parameter1', Value1, 'Parameter2', Value2, ...)
Note You must have a license for Curve Fitting Toolbox software to use the fitSmoothingSpline method. |
| Type | Type of interest-rate curve for a bond: forward. |
| Settle | Scalar or column vector of settlement dates. |
| Instruments | N-by-4 data matrix for Instruments where the first column is Settle date, the second column is Maturity, the third column is the clean price, and the fourth column is a CouponRate for the bond. |
| Lambdafun | 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. |
| Knots | (Optional) Vector of knot locations (times-to-maturity); by default, knots is set to be a vector comprised of 0 and the time to maturity of all input instruments. |
| Compounding | (Optional) Scalar that sets the compounding frequency per year for the IRFunctionCurve object:
|
| Basis | (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 by prepending the word Instrument to the parameter field. For example, prepending InstrumentBasis distinguishes a bond instrument's Basis value from the curve's Basis value.
Period | (Optional) Coupons per year of the bond. A vector of integers. Allowed values are 0, 1, 2 (default), 3, 4, 6, and 12. |
Basis | (Optional) Day-count basis of the bond. A vector of integers.
For more information, see basis. |
EndMonthRule | (Optional) End-of-month rule. A vector. This rule applies only when Maturity is an end-of-month date for a month having 30 or fewer days. 0 = ignore rule, meaning that a bond's coupon payment date is always the same numerical day of the month. 1 = set rule on (default), meaning that a bond's coupon payment date is always the last actual day of the month. |
IssueDate | (Optional) Date when an instrument was issued. |
FirstCouponDate | (Optional) Date when a bond makes its first coupon payment; used when bond has an irregular first coupon period. When FirstCouponDate and LastCouponDate are both specified, FirstCouponDate takes precedence in determining the coupon payment structure. If you do not specify a FirstCouponDate, the cash flow payment dates are determined from other inputs. |
LastCouponDate | (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 FirstCouponDate, a specified LastCouponDate determines the coupon structure of the bond. The coupon structure of a bond is truncated at the LastCouponDate, regardless of where it falls, and is followed only by the bond's maturity cash flow date. If you do not specify a LastCouponDate, the cash flow payment dates are determined from other inputs. |
Face | (Optional) Face or par value. Default = 100. |
Note When using Instrument parameter/value pairs, you can specify simple interest for a bond by specifying the InstrumentPeriod value as 0. If InstrumentBasis and InstrumentPeriod are not specified for a bond, the following default values are used: Basis is 0 (act/act) and Period is 2. |
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 Basis, Compounding, and Knots as parameter/value pairs.
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);
SmoothingModel = IRFunctionCurve.fitSmoothingSpline('Forward',datenum('30-Apr-2008'),...
Instruments,@(t) 1000);
To create the plot:
plot(PlottingPoints,SmoothingModel.getParYields(PlottingPoints),'b')
hold on
scatter(Maturity,Yield,'black')
datetick('x')

View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |