Hello, I have questions about the implementation of HullWhite::tree. I’ve reproduced
the code from hullwhite.cpp here
for reference: boost::shared_ptr<Lattice>
HullWhite::tree(const TimeGrid& grid) const {
TermStructureFittingParameter phi(termStructure());
boost::shared_ptr<ShortRateDynamics> numericDynamics(
new Dynamics(phi, a(), sigma())); boost::shared_ptr<TrinomialTree>
trinomial(
new
TrinomialTree(numericDynamics->process(), grid));
boost::shared_ptr<ShortRateTree> numericTree(
new ShortRateTree(trinomial, numericDynamics,
grid)); typedef TermStructureFittingParameter::NumericalImpl
NumericalImpl;
boost::shared_ptr<NumericalImpl> impl =
boost::dynamic_pointer_cast<NumericalImpl>(phi.implementation());
impl->reset(); for (Size i=0; i<(grid.size() - 1); i++) {
Real discountBond = termStructure()->discount(grid[i+1]);
const Array& statePrices =
numericTree->statePrices(i);
Size size = numericTree->size(i);
Time dt = numericTree->timeGrid().dt(i);
Real dx = trinomial->dx(i);
Real x = trinomial->underlying(i,0);
Real value = 0.0;
for (Size j=0; j<size; j++) {
value += statePrices[j]*std::exp(-x*dt);
x += dx;
}
value = std::log(value/discountBond)/dt;
impl->set(grid[i], value); } return numericTree; } My questions are 1.
What is the difference between numericTree->statePrices(i) and trinomial->underling(i,0)? Aren’t
the values returned by underlying(…)
the actual short rates obtained from the H-W model? What is returned by statePrices? What would value be just before the impl->set(…) statement? 2.
What should I expect in numericTree
upon return? I would expect the actual short rates (or discount factors)
simulated by the H-W model but I don’t think this is true. See question
1. At first I thought tree(…)
returned what I wanted – an actual array (Lattice)
of interest rate paths with short rates (or discount factors) simulated by the
H-W model. I could then use these rates to calculate cashflows. But perhaps I’m
missing something. Before sending this email, I read the HW paper “Using
Hull-White Interest Rate Trees”, searched the Quantlib examples and testsuite,
read the class module documentation, the source code, and documents on http://quantlib.org/docs.shtml.
Please provide any additional pointers to docs I can use to understand this, or
perhaps some pointers to sample code I missed that would help. Additionally, I
can provide a summary back to the list for future reference. Thanks, Dale Smith, Ph.D. Senior Financial Quantitative Analyst Risk & Compliance Fiserv. 107 Technology Park Norcross, GA 30092 Office: 678-375-5315 Mobile: 678-982-6599 Mail: [hidden email] ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense.. http://p.sf.net/sfu/splunk-d2d-c1 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi. I can’t completely answer your questions yet; but have made some
progress after going through the code and the suggested paper.
The code looks a numerical implementation of Hull-White. I have also
referenced another book “Options, Futures, and Other Derivatives” by Hull; that
book’s chapter 30 have some introductions to the H-W numerical procedure.
Do you have access to the book?
And, I guess we can again find helpful discussions in: Fabio Mercurio’s
book “Interest Rate Models”, Hull’s paper
“Numerical procedures for implementing term structure models I: Single-Factor
Models”, and Hull’s book “Interest Rate Derivatives”. Unfortunately I
haven’t got access to those references. Do you have them? Look
forward to more discussions.
Regards,
Hong Yu
From: [hidden email]
Sent: Friday, June 24, 2011 11:35 PM
To: [hidden email]
Subject: [Quantlib-users] Understanding HullWhite::tree
method Hello, I have questions about the implementation of HullWhite::tree. I’ve reproduced the
code from hullwhite.cpp here for
reference:
boost::shared_ptr<Lattice> HullWhite::tree(const TimeGrid& grid) const {
TermStructureFittingParameter phi(termStructure());
boost::shared_ptr<ShortRateDynamics>
numericDynamics(
new Dynamics(phi, a(),
sigma()));
boost::shared_ptr<TrinomialTree> trinomial(
new
TrinomialTree(numericDynamics->process(), grid));
boost::shared_ptr<ShortRateTree> numericTree(
new ShortRateTree(trinomial, numericDynamics,
grid));
typedef
TermStructureFittingParameter::NumericalImpl
NumericalImpl;
boost::shared_ptr<NumericalImpl> impl =
boost::dynamic_pointer_cast<NumericalImpl>(phi.implementation());
impl->reset();
for (Size i=0; i<(grid.size() - 1); i++)
{
Real discountBond =
termStructure()->discount(grid[i+1]);
const Array& statePrices =
numericTree->statePrices(i);
Size size = numericTree->size(i);
Time dt = numericTree->timeGrid().dt(i);
Real dx = trinomial->dx(i);
Real x = trinomial->underlying(i,0);
Real value = 0.0;
for (Size j=0; j<size; j++)
{
value += statePrices[j]*std::exp(-x*dt);
x += dx;
}
value = std::log(value/discountBond)/dt;
impl->set(grid[i], value);
}
return numericTree;
} My questions are 1.
What is the difference between numericTree->statePrices(i) and
trinomial->underling(i,0)?
Aren’t the values returned by underlying(…) the actual short rates
obtained from the H-W model? What is returned by statePrices? What would value be just before the impl->set(…) statement? 2.
What should I expect in numericTree upon return? I would
expect the actual short rates (or discount factors) simulated by the H-W model
but I don’t think this is true. See question 1. At first I thought tree(…) returned what I wanted – an
actual array (Lattice) of
interest rate paths with short rates (or discount factors) simulated by the H-W
model. I could then use these rates to calculate cashflows. But perhaps I’m
missing something. Before sending this email, I read the HW paper “Using
Hull-White Interest Rate Trees”, searched the Quantlib examples and testsuite,
read the class module documentation, the source code, and documents on http://quantlib.org/docs.shtml. Please
provide any additional pointers to docs I can use to understand this, or perhaps
some pointers to sample code I missed that would help. Additionally, I can
provide a summary back to the list for future reference. Thanks, Dale
Smith, Ph.D. Senior
Financial Quantitative Analyst Risk
& Compliance Fiserv. 107
Technology Park Norcross,
GA 30092 Office:
678-375-5315 Mobile:
678-982-6599 Mail:
[hidden email]
------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense.. http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi, I don’t have Hull’s paper, nor
do I have Hull’s “Interest Rate Derivatives”. I’ll take a look at Chapter 30
before I respond further. Thanks, Dale Smith, Ph.D. Senior Financial Quantitative Analyst Risk & Compliance Fiserv. 107 Technology Park Norcross, GA 30092 Office: 678-375-5315 Mobile: 678-982-6599 Mail: [hidden email] From: Hong Yu
[mailto:[hidden email]] Hi. I can’t
completely answer your questions yet; but have made some progress after going
through the code and the suggested paper. The code looks a
numerical implementation of Hull-White. I have also referenced another
book “Options, Futures, and Other Derivatives” by Hull; that book’s chapter 30
have some introductions to the H-W numerical procedure. Do you have
access to the book? And, I guess we
can again find helpful discussions in: Fabio Mercurio’s book “Interest Rate Models”, Hull’s paper “Numerical procedures
for implementing term structure models I: Single-Factor Models”, and Hull’s
book “Interest Rate Derivatives”.
Unfortunately I haven’t got access to those references. Do you have
them? Look forward to more discussions. Regards, Hong Yu From: [hidden email]
Sent: Friday,
June 24, 2011 11:35 PM To: [hidden email]
Subject:
[Quantlib-users] Understanding HullWhite::tree method Hello, I have questions about the
implementation of HullWhite::tree. I’ve reproduced the code from hullwhite.cpp here for reference: boost::shared_ptr<Lattice>
HullWhite::tree(const TimeGrid& grid) const {
TermStructureFittingParameter phi(termStructure());
boost::shared_ptr<ShortRateDynamics> numericDynamics(
new Dynamics(phi, a(),
sigma()));
boost::shared_ptr<TrinomialTree> trinomial(
new
TrinomialTree(numericDynamics->process(), grid));
boost::shared_ptr<ShortRateTree> numericTree(
new
ShortRateTree(trinomial, numericDynamics, grid)); typedef
TermStructureFittingParameter::NumericalImpl NumericalImpl;
boost::shared_ptr<NumericalImpl> impl =
boost::dynamic_pointer_cast<NumericalImpl>(phi.implementation()); impl->reset(); for (Size i=0;
i<(grid.size() - 1); i++) {
Real discountBond = termStructure()->discount(grid[i+1]);
const Array&
statePrices = numericTree->statePrices(i);
Size size = numericTree->size(i);
Time dt = numericTree->timeGrid().dt(i);
Real dx = trinomial->dx(i);
Real x = trinomial->underlying(i,0);
Real value = 0.0;
for (Size j=0; j<size;
j++) {
value += statePrices[j]*std::exp(-x*dt);
x += dx;
}
value = std::log(value/discountBond)/dt;
impl->set(grid[i], value); } return numericTree; } My questions are 1.
What is the difference
between numericTree->statePrices(i) and trinomial->underling(i,0)?
Aren’t the values returned by underlying(…) the actual short
rates obtained from the H-W model? What is returned by statePrices? What would value be just before the impl->set(…) statement? 2.
What should I expect
in numericTree upon return? I would expect the actual short rates (or
discount factors) simulated by the H-W model but I don’t think this is true.
See question 1. At first I thought tree(…) returned what I wanted – an actual array (Lattice) of interest rate paths with short rates (or discount
factors) simulated by the H-W model. I could then use these rates to calculate
cashflows. But perhaps I’m missing something. Before sending this email, I read
the HW paper “Using Hull-White Interest Rate Trees”, searched the Quantlib
examples and testsuite, read the class module documentation, the source code,
and documents on http://quantlib.org/docs.shtml.
Please provide any additional pointers to docs I can use to understand this, or
perhaps some pointers to sample code I missed that would help. Additionally, I
can provide a summary back to the list for future reference. Thanks, Dale Smith, Ph.D. Senior Financial Quantitative Analyst Risk & Compliance Fiserv. 107 Technology Park Norcross, GA 30092 Office: 678-375-5315 Mobile: 678-982-6599 Mail: [hidden email] ------------------------------------------------------------------------------ _______________________________________________ ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi. I have read Hull’s “Options ...” book too, particularly the parts
on H-W trinomial-tree building procedure. Compared to the code, it seems
that ‘value’ in each i-loop corresponding to the displacement function alpha(),
‘statePrices’ corresponding to Q(), ‘underlying()’ are initial interest-rate and
interest-rate related computing parameters. Do you intend to use H-W on
real financial data?
Also, I have got H-W’s paper on numerical procedure (I) and 2001 version of
F Mercurio’s book. If you would be interested, I am happy to share a copy
of the references.
Regards,
Hong Yu
From: [hidden email]
Sent: Monday, June 27, 2011 8:41 PM
To: [hidden email]
Cc: [hidden email]
Subject: RE: [Quantlib-users] Understanding HullWhite::tree
method Hi, I don’t have Hull’s paper, nor
do I have Hull’s “Interest Rate Derivatives”. I’ll take a look at Chapter 30
before I respond further. Thanks, Dale
Smith, Ph.D. Senior
Financial Quantitative Analyst Risk
& Compliance Fiserv. 107
Technology Park Norcross,
GA 30092 Office:
678-375-5315 Mobile:
678-982-6599 Mail:
[hidden email] From: Hong Yu
[mailto:[hidden email]] Hi. I can’t
completely answer your questions yet; but have made some progress after going
through the code and the suggested paper. The code looks a
numerical implementation of Hull-White. I have also referenced another
book “Options, Futures, and Other Derivatives” by Hull; that book’s chapter 30
have some introductions to the H-W numerical procedure. Do you have access
to the book? And, I guess we
can again find helpful discussions in: Fabio Mercurio’s book “Interest Rate Models”, Hull’s paper “Numerical procedures
for implementing term structure models I: Single-Factor Models”, and Hull’s book
“Interest Rate Derivatives”. Unfortunately I
haven’t got access to those references. Do you have them? Look
forward to more discussions. Regards, Hong
Yu From: [hidden email]
Sent:
Friday, June 24, 2011 11:35 PM To: [hidden email]
Subject:
[Quantlib-users] Understanding HullWhite::tree
method Hello, I have questions about the
implementation of HullWhite::tree. I’ve reproduced the code from hullwhite.cpp here for reference:
boost::shared_ptr<Lattice> HullWhite::tree(const TimeGrid&
grid) const
{
TermStructureFittingParameter phi(termStructure());
boost::shared_ptr<ShortRateDynamics>
numericDynamics(
new Dynamics(phi,
a(), sigma()));
boost::shared_ptr<TrinomialTree> trinomial(
new
TrinomialTree(numericDynamics->process(), grid));
boost::shared_ptr<ShortRateTree> numericTree(
new
ShortRateTree(trinomial, numericDynamics, grid));
typedef
TermStructureFittingParameter::NumericalImpl
NumericalImpl;
boost::shared_ptr<NumericalImpl> impl =
boost::dynamic_pointer_cast<NumericalImpl>(phi.implementation());
impl->reset();
for (Size i=0;
i<(grid.size() - 1); i++) {
Real discountBond =
termStructure()->discount(grid[i+1]);
const Array&
statePrices = numericTree->statePrices(i);
Size size = numericTree->size(i);
Time dt = numericTree->timeGrid().dt(i);
Real dx = trinomial->dx(i);
Real x = trinomial->underlying(i,0);
Real value = 0.0;
for (Size j=0;
j<size; j++) {
value += statePrices[j]*std::exp(-x*dt);
x += dx;
}
value = std::log(value/discountBond)/dt;
impl->set(grid[i], value);
}
return
numericTree;
} My questions
are 1.
What is the difference between
numericTree->statePrices(i) and trinomial->underling(i,0)? Aren’t the values returned by underlying(…) the actual short rates obtained from the H-W model? What
is returned by statePrices? What would value be just before the impl->set(…) statement? 2.
What should I expect in
numericTree upon return? I would expect the actual short rates (or
discount factors) simulated by the H-W model but I don’t think this is true. See
question 1. At first I thought tree(…) returned what I wanted – an actual array (Lattice) of interest rate paths with short rates (or discount
factors) simulated by the H-W model. I could then use these rates to calculate
cashflows. But perhaps I’m missing something. Before sending this email, I read
the HW paper “Using Hull-White Interest Rate Trees”, searched the Quantlib
examples and testsuite, read the class module documentation, the source code,
and documents on http://quantlib.org/docs.shtml. Please
provide any additional pointers to docs I can use to understand this, or perhaps
some pointers to sample code I missed that would help. Additionally, I can
provide a summary back to the list for future reference. Thanks, Dale
Smith, Ph.D. Senior
Financial Quantitative Analyst Risk
& Compliance Fiserv. 107
Technology Park Norcross,
GA 30092 Office:
678-375-5315 Mobile:
678-982-6599 Mail:
[hidden email] ------------------------------------------------------------------------------ _______________________________________________ ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
I did read Chapter 30 yesterday
afternoon and came to the same conclusion – underlying() is the interest rate.
I’m studying the Monte Carlo Framework right now as I think that may be better
than calling HullWhite::tree() to get the simulated path. I think I read in the
documentation that statePrice() is an Arrow-Debreu price, which implies it’s a
discount bond in this case. http://quantlib.org/reference/group__mcarlo.html I have a copy of the Brigo &
Mercurio book, thanks. I’m afraid my firm wouldn’t like it were I to obtain the
HW paper so I have to make sure I respect copyright, thanks. I’m using the HW model for our
initial needs. But I’m not working for a trading desk. I’m interested in
valuation of bank asset/liabilities in order to simulate the entire balance
sheet and scenario analyses. Thanks, Dale Smith, Ph.D. Senior Financial Quantitative Analyst Risk & Compliance Fiserv. 107 Technology Park Norcross, GA 30092 Office: 678-375-5315 Mobile: 678-982-6599 Mail: [hidden email] From: Hong Yu
[mailto:[hidden email]] Hi. I have
read Hull’s “Options ...” book too, particularly the parts on H-W
trinomial-tree building procedure. Compared to the code, it seems that
‘value’ in each i-loop corresponding to the displacement function alpha(), ‘statePrices’
corresponding to Q(), ‘underlying()’ are initial interest-rate and
interest-rate related computing parameters. Do you intend to use H-W on
real financial data? Also, I have got
H-W’s paper on numerical procedure (I) and 2001 version of F Mercurio’s
book. If you would be interested, I am happy to share a copy of the
references. Regards, Hong Yu From: [hidden email]
Sent: Monday,
June 27, 2011 8:41 PM To: [hidden email] Cc: [hidden email]
Subject: RE:
[Quantlib-users] Understanding HullWhite::tree method Hi, I don’t have Hull’s paper, nor
do I have Hull’s “Interest Rate Derivatives”. I’ll take a look at Chapter 30
before I respond further. Thanks, Dale Smith, Ph.D. Senior Financial Quantitative Analyst Risk & Compliance Fiserv. 107 Technology Park Norcross, GA 30092 Office: 678-375-5315 Mobile: 678-982-6599 Mail: [hidden email] From: Hong Yu [mailto:[hidden email]] Hi. I can’t
completely answer your questions yet; but have made some progress after going
through the code and the suggested paper. The code looks a
numerical implementation of Hull-White. I have also referenced another
book “Options, Futures, and Other Derivatives” by Hull; that book’s chapter 30
have some introductions to the H-W numerical procedure. Do you have
access to the book? And, I guess we
can again find helpful discussions in: Fabio Mercurio’s book “Interest Rate Models”, Hull’s paper “Numerical procedures
for implementing term structure models I: Single-Factor Models”, and Hull’s
book “Interest Rate Derivatives”.
Unfortunately I haven’t got access to those references. Do you have
them? Look forward to more discussions. Regards, Hong Yu From: [hidden email]
Sent: Friday,
June 24, 2011 11:35 PM To: [hidden email]
Subject:
[Quantlib-users] Understanding HullWhite::tree method Hello, I have questions about the
implementation of HullWhite::tree. I’ve reproduced the code from hullwhite.cpp here for reference: boost::shared_ptr<Lattice> HullWhite::tree(const TimeGrid& grid) const {
TermStructureFittingParameter phi(termStructure());
boost::shared_ptr<ShortRateDynamics> numericDynamics(
new Dynamics(phi, a(),
sigma()));
boost::shared_ptr<TrinomialTree> trinomial(
new
TrinomialTree(numericDynamics->process(), grid));
boost::shared_ptr<ShortRateTree> numericTree(
new
ShortRateTree(trinomial, numericDynamics, grid)); typedef
TermStructureFittingParameter::NumericalImpl NumericalImpl;
boost::shared_ptr<NumericalImpl> impl =
boost::dynamic_pointer_cast<NumericalImpl>(phi.implementation()); impl->reset(); for (Size i=0; i<(grid.size()
- 1); i++) {
Real discountBond = termStructure()->discount(grid[i+1]);
const Array&
statePrices = numericTree->statePrices(i);
Size size = numericTree->size(i);
Time dt = numericTree->timeGrid().dt(i);
Real dx = trinomial->dx(i);
Real x = trinomial->underlying(i,0);
Real value = 0.0;
for (Size j=0; j<size;
j++) {
value += statePrices[j]*std::exp(-x*dt);
x += dx;
}
value = std::log(value/discountBond)/dt;
impl->set(grid[i], value); } return numericTree; } My questions are 1.
What is the difference
between numericTree->statePrices(i) and trinomial->underling(i,0)?
Aren’t the values returned by underlying(…) the actual short
rates obtained from the H-W model? What is returned by statePrices? What would value be just before the impl->set(…) statement? 2.
What should I expect
in numericTree upon return? I would expect the actual short rates (or
discount factors) simulated by the H-W model but I don’t think this is true.
See question 1. At first I thought tree(…) returned what I wanted – an actual array (Lattice) of interest rate paths with short rates (or discount
factors) simulated by the H-W model. I could then use these rates to calculate
cashflows. But perhaps I’m missing something. Before sending this email, I read
the HW paper “Using Hull-White Interest Rate Trees”, searched the Quantlib
examples and testsuite, read the class module documentation, the source code,
and documents on http://quantlib.org/docs.shtml.
Please provide any additional pointers to docs I can use to understand this, or
perhaps some pointers to sample code I missed that would help. Additionally, I
can provide a summary back to the list for future reference. Thanks, Dale Smith, Ph.D. Senior Financial Quantitative Analyst Risk & Compliance Fiserv. 107 Technology Park Norcross, GA 30092 Office: 678-375-5315 Mobile: 678-982-6599 Mail: [hidden email] ------------------------------------------------------------------------------ _______________________________________________ ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |