Hi Luigi, Sad, everybody.
Following the precious suggestions given by Luigi, I added the attached module to my QuantLib project.
Unfortunately, the calibration does not work as expected. This is visible after running the following test:
1) calibrate the standard Hull-White model with a termstructure and a set of calibration helpers. Use Simplex optimization algorithm as in BermudanSwaption example.
2) store the resulting parameters, alpha and sigma
3) calibrate the FixedAlphaHullWhite built with the stored alpha, using the same helpers.
After the 2nd calibration, you wil get the stored alpha, as expected, but the sigma is quite different from the one calibrated previously.
I have big trouble in debugging the code. Maybe that somebody who knows better than me the architecture and the mathematics of this part of QuantLib can help me?
Thanks
Francesco
-----Original Message-----
From: Luigi Ballabio [[hidden email]]
Sent: martedì, 16 settembre 2003 16:49
To: Perissin Francesco; '[hidden email]'
Subject: Re: [Quantlib-users] Hull - White Calibration
At 03:16 PM 9/16/03, Perissin Francesco wrote:
>I am calibrating my Hull-White model in QL 0.3.1 using more or less the
>same code given in bermudan swaption example. This means considering a set
>of calibration helpers, and finding the parameters alfa and sigma that
>minimize the error function, via the simplex optimization method.
>
>Now I'd like to modify slightly this code, in order to keep a given
>alfa
>and to find the best sigma. Clearly, this is a much simpler problem since
>I have a single parameter to calibrate. Unfortunately, I am not an expert
>user of the library and I'd need some hints in order to reach the goal in
>a "decent" way...
Hi Francesco,
long time no see. Upon a superficial inspection of the code, it seems
to me that Sad didn't leave a hook for doing what you need. Were I to
tackle it, I would do something like:
1) create a new class:
class FixedAlphaHullWhite : public HullWhite { ... };
2) inside the new class, define an inner class:
class FixedAlphaConstraint : public Constraint { ... };
equal to Model::PrivateConstraint, but whose method test() works as:
if (params[0] != fixedAlpha_)
return false;
else {
... // same as PrivateConstraint
}
and whose constructor accepts and store the fixed alpha value besides the
other parameters;
3) define the constructor of the FixedAlphaHullWhite class as:
FixedAlphaHullWhite(const RelinkableHandle<TermStructure>& ts,
double a, double sigma = 0.01)
: HullWhite(ts,a,sigma) {
constraint_ = Handle<Constraint>(
new FixedAlphaConstraint(a, arguments_));
}
4) cross your fingers, compile and hope for the best as the above is highly
untested.
5) add a feature request to the QuantLib tracker
(https://sourceforge.net/tracker/?group_id=12740&atid=362740)
called "Adding custom constraints to short-rate model calibration" or
something of the kind. Describe the problem shortly.
Hope this helps,
Luigi
############################### DISCLAIMER #################################
This message (including any attachments) is confidential and may be
privileged. If you have received it by mistake please notify the sender by
return e-mail and delete this message from your system. Any unauthorised
use or dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change. Banca del
Gottardo (including its group companies) shall not be liable for the
improper or incomplete transmission of the information contained in this
communication nor for any delay in its receipt or damage to your system.
Banca del Gottardo (or its group companies) does not guarantee that the
integrity of this communication has been maintained nor that this
communication is free of viruses, interceptions or interference.
############################################################################
| Free forum by Nabble | Edit this page |