Why does HULLWHITE1F show negative forward rates when my input zero rates are all positive in Financial Instruments Toolbox 1.1 (R2013a)?

1 view (last 30 days)
I try to run a simulation using a HULLWHITE1F model. When my zero rates are at 0.1 and then go up to 0.2, I get negative forward rates which makes no sense. To see this, execute the following code snippet:
 
Settle = datenum('15-Aug-2013');
CurveTimes = [1 2 5 7]';
ZeroRates = [.01 .01 .02 .02]';
CurveDates = daysadd(Settle,360*CurveTimes,1);
irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates,'Compounding',-1,'basis',1);
alpha = .1;
sigma = 0;
HW1F = HullWhite1F(irdc,alpha,sigma);
[zeroRates2, forwardRates2] = HW1F.simTermStructs(10,'nTrials', 3)
Also, if my mean reversion (alpha) is set to 0, I get NAN in my rates:
 
CurveTimes = [1 2 5 7]';
ZeroRates = [.01 .01 .02 .02]';
CurveDates = daysadd(Settle,360*CurveTimes,1);
irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates);
alpha = .0;
sigma = .0;
HW1F = HullWhite1F(irdc,alpha,sigma);
[zeroRates3, forwardRates3] = HW1F.simTermStructs(10,'nTrials', 3)
Why does this happen?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Jul 2015
There is a bug in HULLWHITE1F. m in Financial Instruments Toolbox 1.1 (R2013a). To work around this issue, download the attached version of the HullWhite1F.m file. Here are the steps:
1. Find the $MATLABROOT directory where $MATLABROOT is the MATLAB root directory on your machine, as returned by executing:
 
>> matlabroot
at the MATLAB Command Prompt.
2. Quit MATLAB.
3. Rename the following M-file:
$MATLABROOT\toolbox\fininst\fininst\HullWhite1F.m
Rename the file to HULWHITE1F.m.old
4. Download the attached file(s). Place the new file(s) in the same directory mentioned in step 3.
5. Restart MATLAB
6. After restarting MATLAB, issue the following command at the MATLAB Command Prompt:
 
>> rehash toolboxcache
  1 Comment
Walter Roberson
Walter Roberson on 5 May 2015
The attachment is indeed missing. Furthermore there is no accessible bug report on this topic, and the release notes do not list it in any release.

Sign in to comment.

More Answers (0)

Products


Release

R2013a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!