Discussion:
[Quantlib-users] Matching results between HW tree and simulation models
Rakesh
2015-03-23 17:07:19 UTC
Permalink
Folks -

I would assume that the Hull-white tree (or lattice) based model and the
HW simulation model should be equivalent.

Would that be an incorrect assumption in the context of QuantLib?

Rakesh
Rakesh Gupta
2015-03-23 17:22:11 UTC
Permalink
Post by Rakesh
Folks -
I would assume that the Hull-white tree (or lattice) based model and the
HW simulation model should be equivalent.
Would that be an incorrect assumption in the context of QuantLib?
Rakesh
--------------------------------------------------------------------------
----
Post by Rakesh
Dive into the World of Parallel Programming The Go Parallel Website,
sponsored
Post by Rakesh
by Intel and developed in partnership with Slashdot Media, is your hub
for all
Post by Rakesh
things parallel software development, from weekly thought leadership
blogs to
Post by Rakesh
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
Just to follow up on what I am finding:

I have attached a simple code that tries a sanity check. Starting
with some discount curve, I want to see that I can recover correct
zero coupon bond prices from a Hull White trinomial tree and a
simulation. What I find is that the lattice does a perfect job
recovering the term structure. The simulation does not unless I set
volatility to zero. If I let the number of paths in the simulation
grow very high (e.g. 200000), then zero prices out far on the time
axis are better recovered, but it doesn’t seem sensible to me that I
should require so many paths. Also, a third-party implementation
does not require any large number of paths to recover the
termstructure.

You can run my test program with a command like this:

./discounttest 100 30 .01 .01

Any help you can provide would be appreciated.

Thanks,

Rakesh

---- begin code ----

#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>

#include <boost/shared_ptr.hpp>

#include <ql/quantlib.hpp>

using namespace std;

using namespace boost;

using namespace QuantLib;

DiscountFactor discount(const Matrix &paths,
const TimeGrid &grid,
const Time &t)
{
Size nPaths(paths.rows());
vector<Real> spots(nPaths, 0.0);
for (Size step(grid.index(t)); step > 0; --step)
{
for (Size path(0); path < nPaths; ++path)
{
spots[path] += paths[path][step - 1] * grid.dt(step - 1);
}
}

vector<Real> dfs(paths.rows());
for (Size path(0); path < nPaths; ++path)
{
dfs[path] = exp(-spots[path]);
}
return accumulate(dfs.begin(), dfs.end(), 0.0) / dfs.size();
}

int
main(int argc, char *argv[])
{
if (argc < 5)
{
cerr << "Usage: " << argv[0] <<
" <num-paths> <num-steps> <a> <sigma>" << endl;
return -1;
}

istringstream sNumPaths(argv[1]), sNumSteps(argv[2]);
istringstream sA(argv[3]), sSigma(argv[4]);

const Date &referenceDate = Date::todaysDate();
Handle<Quote> forward(new SimpleQuote(0.05));
ActualActual dayCounter;
shared_ptr<YieldTermStructure> yield(new FlatForward(referenceDate,
forward,
dayCounter));
Real a, sigma;
sA >> a;
sSigma >> sigma;

shared_ptr<HullWhite> hw(new HullWhite(Handle<YieldTermStructure>(yield),
a,
sigma));

Size numPaths, numSteps;
sNumPaths >> numPaths;
sNumSteps >> numSteps;

TimeGrid grid((Time)30, numSteps);
shared_ptr<HullWhiteProcess> hwProcess(new HullWhiteProcess
(Handle<YieldTermStructure>(yield),
a,
sigma));
PathGenerator<SobolBrownianBridgeRsg> generator(hwProcess,
grid,
SobolBrownianBridgeRsg(1,
(grid.size() - 1)),
false);
numSteps = grid.size();
Matrix paths(numPaths, numSteps);
for (Size path(0); path < numPaths; ++path)
{
const PathGenerator<SobolBrownianBridgeRsg>::sample_type &draw =
generator.next();

for (Size step(0); step < numSteps; ++step)
{
paths[path][step] = draw.value[step];
}
}

for (TimeGrid::const_reverse_iterator t(grid.rbegin()); t != grid.rend();
t++)
{
DiscretizedDiscountBond zero;
zero.initialize(hw->tree(grid), *t);
cout << "Discount for time t = " << *t
<< " is " << yield->discount(*t)
<< "; HW Tree discount is " << zero.presentValue()
<< "; SIM discount is " << discount(paths, grid, *t)
<< endl;
}

return 0;
}

---- end code ----
Luigi Ballabio
2015-05-04 13:34:32 UTC
Permalink
I haven't had much experience with this, but there's been a blog post
recently on Hull/White simulation; see <
http://gouthamanbalaraman.com/blog/hull-white-simulation-quantlib-python.html
Post by Rakesh
.
Do you find yourself in agreement with that?

Luigi
Post by Rakesh
Post by Rakesh
Folks -
I would assume that the Hull-white tree (or lattice) based model and the
HW simulation model should be equivalent.
Would that be an incorrect assumption in the context of QuantLib?
Rakesh
--------------------------------------------------------------------------
----
Post by Rakesh
Dive into the World of Parallel Programming The Go Parallel Website,
sponsored
Post by Rakesh
by Intel and developed in partnership with Slashdot Media, is your hub
for all
Post by Rakesh
things parallel software development, from weekly thought leadership
blogs to
Post by Rakesh
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
I have attached a simple code that tries a sanity check. Starting
with some discount curve, I want to see that I can recover correct
zero coupon bond prices from a Hull White trinomial tree and a
simulation. What I find is that the lattice does a perfect job
recovering the term structure. The simulation does not unless I set
volatility to zero. If I let the number of paths in the simulation
grow very high (e.g. 200000), then zero prices out far on the time
axis are better recovered, but it doesn’t seem sensible to me that I
should require so many paths. Also, a third-party implementation
does not require any large number of paths to recover the
termstructure.
./discounttest 100 30 .01 .01
Any help you can provide would be appreciated.
Thanks,
Rakesh
---- begin code ----
#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <ql/quantlib.hpp>
using namespace std;
using namespace boost;
using namespace QuantLib;
DiscountFactor discount(const Matrix &paths,
const TimeGrid &grid,
const Time &t)
{
Size nPaths(paths.rows());
vector<Real> spots(nPaths, 0.0);
for (Size step(grid.index(t)); step > 0; --step)
{
for (Size path(0); path < nPaths; ++path)
{
spots[path] += paths[path][step - 1] * grid.dt(step - 1);
}
}
vector<Real> dfs(paths.rows());
for (Size path(0); path < nPaths; ++path)
{
dfs[path] = exp(-spots[path]);
}
return accumulate(dfs.begin(), dfs.end(), 0.0) / dfs.size();
}
int
main(int argc, char *argv[])
{
if (argc < 5)
{
cerr << "Usage: " << argv[0] <<
" <num-paths> <num-steps> <a> <sigma>" << endl;
return -1;
}
istringstream sNumPaths(argv[1]), sNumSteps(argv[2]);
istringstream sA(argv[3]), sSigma(argv[4]);
const Date &referenceDate = Date::todaysDate();
Handle<Quote> forward(new SimpleQuote(0.05));
ActualActual dayCounter;
shared_ptr<YieldTermStructure> yield(new FlatForward(referenceDate,
forward,
dayCounter));
Real a, sigma;
sA >> a;
sSigma >> sigma;
shared_ptr<HullWhite> hw(new HullWhite(Handle<YieldTermStructure>(yield),
a,
sigma));
Size numPaths, numSteps;
sNumPaths >> numPaths;
sNumSteps >> numSteps;
TimeGrid grid((Time)30, numSteps);
shared_ptr<HullWhiteProcess> hwProcess(new HullWhiteProcess
(Handle<YieldTermStructure>(yield),
a,
sigma));
PathGenerator<SobolBrownianBridgeRsg> generator(hwProcess,
grid,
SobolBrownianBridgeRsg(1,
(grid.size() - 1)),
false);
numSteps = grid.size();
Matrix paths(numPaths, numSteps);
for (Size path(0); path < numPaths; ++path)
{
const PathGenerator<SobolBrownianBridgeRsg>::sample_type &draw =
generator.next();
for (Size step(0); step < numSteps; ++step)
{
paths[path][step] = draw.value[step];
}
}
for (TimeGrid::const_reverse_iterator t(grid.rbegin()); t != grid.rend();
t++)
{
DiscretizedDiscountBond zero;
zero.initialize(hw->tree(grid), *t);
cout << "Discount for time t = " << *t
<< " is " << yield->discount(*t)
<< "; HW Tree discount is " << zero.presentValue()
<< "; SIM discount is " << discount(paths, grid, *t)
<< endl;
}
return 0;
}
---- end code ----
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website,
sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for
all
things parallel software development, from weekly thought leadership blogs
to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
--
<http://leanpub.com/implementingquantlib/>
<http://implementingquantlib.com>
<http://twitter.com/lballabio>
Peter Caspers
2015-05-05 18:51:32 UTC
Permalink
Rakesh,

what do you get in your third party implementation, with how many
paths, time steps and which way of generating random numbers ?

best regards, Peter
Post by Luigi Ballabio
I haven't had much experience with this, but there's been a blog post
recently on Hull/White simulation; see
<http://gouthamanbalaraman.com/blog/hull-white-simulation-quantlib-python.html>.
Do you find yourself in agreement with that?
Luigi
Post by Rakesh Gupta
Post by Rakesh
Folks -
I would assume that the Hull-white tree (or lattice) based model and the
HW simulation model should be equivalent.
Would that be an incorrect assumption in the context of QuantLib?
Rakesh
--------------------------------------------------------------------------
----
Post by Rakesh
Dive into the World of Parallel Programming The Go Parallel Website,
sponsored
Post by Rakesh
by Intel and developed in partnership with Slashdot Media, is your hub
for all
Post by Rakesh
things parallel software development, from weekly thought leadership
blogs to
Post by Rakesh
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
I have attached a simple code that tries a sanity check. Starting
with some discount curve, I want to see that I can recover correct
zero coupon bond prices from a Hull White trinomial tree and a
simulation. What I find is that the lattice does a perfect job
recovering the term structure. The simulation does not unless I set
volatility to zero. If I let the number of paths in the simulation
grow very high (e.g. 200000), then zero prices out far on the time
axis are better recovered, but it doesn’t seem sensible to me that I
should require so many paths. Also, a third-party implementation
does not require any large number of paths to recover the
termstructure.
./discounttest 100 30 .01 .01
Any help you can provide would be appreciated.
Thanks,
Rakesh
---- begin code ----
#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <ql/quantlib.hpp>
using namespace std;
using namespace boost;
using namespace QuantLib;
DiscountFactor discount(const Matrix &paths,
const TimeGrid &grid,
const Time &t)
{
Size nPaths(paths.rows());
vector<Real> spots(nPaths, 0.0);
for (Size step(grid.index(t)); step > 0; --step)
{
for (Size path(0); path < nPaths; ++path)
{
spots[path] += paths[path][step - 1] * grid.dt(step - 1);
}
}
vector<Real> dfs(paths.rows());
for (Size path(0); path < nPaths; ++path)
{
dfs[path] = exp(-spots[path]);
}
return accumulate(dfs.begin(), dfs.end(), 0.0) / dfs.size();
}
int
main(int argc, char *argv[])
{
if (argc < 5)
{
cerr << "Usage: " << argv[0] <<
" <num-paths> <num-steps> <a> <sigma>" << endl;
return -1;
}
istringstream sNumPaths(argv[1]), sNumSteps(argv[2]);
istringstream sA(argv[3]), sSigma(argv[4]);
const Date &referenceDate = Date::todaysDate();
Handle<Quote> forward(new SimpleQuote(0.05));
ActualActual dayCounter;
shared_ptr<YieldTermStructure> yield(new FlatForward(referenceDate,
forward,
dayCounter));
Real a, sigma;
sA >> a;
sSigma >> sigma;
shared_ptr<HullWhite> hw(new
HullWhite(Handle<YieldTermStructure>(yield),
a,
sigma));
Size numPaths, numSteps;
sNumPaths >> numPaths;
sNumSteps >> numSteps;
TimeGrid grid((Time)30, numSteps);
shared_ptr<HullWhiteProcess> hwProcess(new HullWhiteProcess
(Handle<YieldTermStructure>(yield),
a,
sigma));
PathGenerator<SobolBrownianBridgeRsg> generator(hwProcess,
grid,
SobolBrownianBridgeRsg(1,
(grid.size() - 1)),
false);
numSteps = grid.size();
Matrix paths(numPaths, numSteps);
for (Size path(0); path < numPaths; ++path)
{
const PathGenerator<SobolBrownianBridgeRsg>::sample_type &draw =
generator.next();
for (Size step(0); step < numSteps; ++step)
{
paths[path][step] = draw.value[step];
}
}
for (TimeGrid::const_reverse_iterator t(grid.rbegin()); t != grid.rend();
t++)
{
DiscretizedDiscountBond zero;
zero.initialize(hw->tree(grid), *t);
cout << "Discount for time t = " << *t
<< " is " << yield->discount(*t)
<< "; HW Tree discount is " << zero.presentValue()
<< "; SIM discount is " << discount(paths, grid, *t)
<< endl;
}
return 0;
}
---- end code ----
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website,
sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for
all
things parallel software development, from weekly thought leadership blogs
to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
--
<http://leanpub.com/implementingquantlib/>
<http://implementingquantlib.com>
<http://twitter.com/lballabio>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
gouthambs
2015-05-06 15:12:55 UTC
Permalink
Rakesh

The trees can have better convergence than Monte-Carlo especially if the
random number generation is not well distributed. But you shouldn't have to
generate thousands of paths to get a decent convergence.

I wonder if you can change your GaussianRandomSequenceGenerator template
argument in the PathGenerator and see if that makes a difference?

Goutham




--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16536.html
Sent from the quantlib-users mailing list archive at Nabble.com.
Peter Caspers
2015-05-06 15:57:20 UTC
Permalink
trees (if carefully implemented) should give a perfect match for zero
bonds in any case, so there is no such thing as convergence for them ?
Peter
Post by Rakesh
Rakesh
The trees can have better convergence than Monte-Carlo especially if the
random number generation is not well distributed. But you shouldn't have to
generate thousands of paths to get a decent convergence.
I wonder if you can change your GaussianRandomSequenceGenerator template
argument in the PathGenerator and see if that makes a difference?
Goutham
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16536.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
gouthambs
2015-05-06 17:04:14 UTC
Permalink
Peter

I think the grid size would determine how close the numbers will match the
zero bonds in the tree implementation.

On a side note, I have played with trees to price European options, and I
have noticed that the fair option value from the trees oscillated about the
theoretical value. And how much it differed from the fair value depended on
the grid spacing in the trees.

Check figure 2 in :
http://www.scribd.com/doc/4108897/Options-Pricing-Using-Binomial-Trees


I would expect a similar behavior here, though I haven't tried it myself.

Goutham





--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16538.html
Sent from the quantlib-users mailing list archive at Nabble.com.
Peter Caspers
2015-05-06 18:05:10 UTC
Permalink
Hi Goutham,

thanks for the reference to the paper, it is interesting.

I was only referring to the case zero bonds. I seem to remember that
Hull (in his OFOD-book) describes a procedure for tree building where
(even with the discrete time spacing) zero bonds are _exactly_ matched
(using Arrow-Debreu prices). That's what I meant by "carefully
implemented". If the tree is not carefully implemented, then yes,
you'd need to let \Delta t reach zero to converge to the initial yield
curves' zero bond prices. The HullWhite::tree(const TimeGrid&)
implementation seems to indicate that it is indeed "carefully"
implemented, so zero bonds should be exactly matched independent of
the grid spacing.

All kinds of option pricings are a different matter of course, but
that wasn't the initial question.

Best regards
Peter
Post by gouthambs
Peter
I think the grid size would determine how close the numbers will match the
zero bonds in the tree implementation.
On a side note, I have played with trees to price European options, and I
have noticed that the fair option value from the trees oscillated about the
theoretical value. And how much it differed from the fair value depended on
the grid spacing in the trees.
http://www.scribd.com/doc/4108897/Options-Pricing-Using-Binomial-Trees
I would expect a similar behavior here, though I haven't tried it myself.
Goutham
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16538.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
gouthambs
2015-05-19 15:44:51 UTC
Permalink
Peter

Thanks for pointing to these resources. I still haven't had a chance to
completely understand your response. I have the Hull book, and I believe you
are referring to the zero coupon bond price expression in the trinomial
trees section (Eq 28.25 in my sixth edition copy under "Using Analytic
Results in Conjunction with Trees" section). Is this what you were referring
to?

Goutham







--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16576.html
Sent from the quantlib-users mailing list archive at Nabble.com.
Peter Caspers
2015-05-19 18:07:33 UTC
Permalink
Hi Goutham,

I am not sure. I have the 8th edition and in this it is chapter 30
(Interest Rate Derivatives: Models of the short rate), section 30.7 A
general tree-building procedure, in particular what is described under
"Second stage", which reads " ... however, we want a tree with finite
dt to match the term structure exactly. We therefore use an iterative
procedure to determine the \alpha's." which is then described in the
following.

Best regards
Peter
Post by gouthambs
Peter
Thanks for pointing to these resources. I still haven't had a chance to
completely understand your response. I have the Hull book, and I believe you
are referring to the zero coupon bond price expression in the trinomial
trees section (Eq 28.25 in my sixth edition copy under "Using Analytic
Results in Conjunction with Trees" section). Is this what you were referring
to?
Goutham
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16576.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
gouthambs
2015-05-22 20:55:35 UTC
Permalink
Peter

Thank you for clarifying. Now I understand what you meant. The tree itself
is constructed in such a way that the expectation of the discount factors
matches the market discount factors. Would you agree that if you used the
tree to price a derivative, then the valuation of derivative will depend on
the grid spacing?

Thanks again for your comments. It was very helpful.

Goutham




-----
--
http://GouthamanBalaraman.com
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16582.html
Sent from the quantlib-users mailing list archive at Nabble.com.
Peter Caspers
2015-05-23 15:54:30 UTC
Permalink
yes, a derivative depending on more than today's yield curve would be
dependent on the spacing.
Peter
Post by gouthambs
Peter
Thank you for clarifying. Now I understand what you meant. The tree itself
is constructed in such a way that the expectation of the discount factors
matches the market discount factors. Would you agree that if you used the
tree to price a derivative, then the valuation of derivative will depend on
the grid spacing?
Thanks again for your comments. It was very helpful.
Goutham
-----
--
http://GouthamanBalaraman.com
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16582.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
gouthambs
2015-05-22 18:40:11 UTC
Permalink
Hey Rakesh

The convergence of Monte Carlo simulation of Hull-White model, as it turns
out, not only depends on the number of paths that you use, but also on the
parameters sigma and a that you chose.

I discuss the convergence of Monte Carlo simulation of the Hull-White model
<http://gouthamanbalaraman.com/blog/hull-white-simulation-monte-carlo-convergence.html>
in this blog post. To summarize, good convergence will be obtained for the
P(0,T) as long as T is smaller than sqrt(a/sigma).
In your test case, you chose sigma=a=0.1. This means you will have good
convergence for small number of paths as long as T is roughly a few months.

When you say you have seen good convergence with other vendor products, did
you try the same parameters a, and sigma. It would be very interesting if
that is the case.

Peter, Luigi, I would welcome your thoughts on my analysis.


Goutham






-----
--
http://GouthamanBalaraman.com
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16581.html
Sent from the quantlib-users mailing list archive at Nabble.com.
Peter Caspers
2015-05-23 16:29:23 UTC
Permalink
nice blog in any case. You have something like

Var( r(t) | r(s) ) = \int_s^t [ exp(-a(t-u)) \sigma(u) ]^2 du

from where you can see how the reversion and model volatility affect
the conditional variance of the short rate in a MC simulation (so
bigger \sigma is "bad", bigger a is "good", which seems somewhat
consistent with your statement). However in real life you calibrate to
real market instruments and a and \sigma will adjust to match their
volatility. So if you e.g. prescribe a "big" positive reversion value
the calibrated sigma will be "big" as well and vice versa. So in the
end, if the market volatility is low, your MC simulation will produce
estimates with lower variance, if it is high, you will get a higher
variance. Which is quite obvious looking at it this way. In a zero
volatility market you will only need one path.

Another remark is that it is often useful to change the measure (e.g.
to a T-forward measure) which allows for large jumps in a simulation.
For example if you price a bermudan swaption with MC, you would only
need the exercise times as simulation times without loosing any
accuracy.

Which leads us to the convergence in other vendor products (which are
we talking about btw ?). Let's take an example, NumeriX, which is
quite popular I think. Without having access to it currently, I would
assume that they do not use the risk neutral measure in their Hull
White MC implementation and that zero bonds come out exactly
indepedently of the number of simulation paths. Alex, is that true :-)
?

best regards
Peter
Post by gouthambs
Hey Rakesh
The convergence of Monte Carlo simulation of Hull-White model, as it turns
out, not only depends on the number of paths that you use, but also on the
parameters sigma and a that you chose.
I discuss the convergence of Monte Carlo simulation of the Hull-White model
<http://gouthamanbalaraman.com/blog/hull-white-simulation-monte-carlo-convergence.html>
in this blog post. To summarize, good convergence will be obtained for the
P(0,T) as long as T is smaller than sqrt(a/sigma).
In your test case, you chose sigma=a=0.1. This means you will have good
convergence for small number of paths as long as T is roughly a few months.
When you say you have seen good convergence with other vendor products, did
you try the same parameters a, and sigma. It would be very interesting if
that is the case.
Peter, Luigi, I would welcome your thoughts on my analysis.
Goutham
-----
--
http://GouthamanBalaraman.com
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16581.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Gouthaman Balaraman
2015-05-26 14:41:11 UTC
Permalink
Peter

Yes, the calibration with the market instruments would dictate the values
for a, and sigma. The expression gives us an estimate on selecting the
number of paths needed to obtain convergence in a Monte Carlo simulation (I
haven't seen any discussed in other references so far).

I would have to do some research on your remark about the MC simulation
without the risk neutral measure. I would expect the expression for variance
of the discount factors would be the same in other probability measures as
well. In which case, I wonder how other implementations get better
convergence. It would be nice to get some insight into this.

Goutham




-----
--
http://GouthamanBalaraman.com
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16591.html
Sent from the quantlib-users mailing list archive at Nabble.com.
Peter Caspers
2015-05-26 16:00:48 UTC
Permalink
Hi Goutham,

what I meant is (maybe a bit too trivial): If the engine uses the
T-Forward measure to price a cashflow of 1 paid at T, then the
simulation will return 1 on all paths, the mean will be exactly 1 and
this is finally multiplied by P(0,T) on today's curve to get the NPV,
so yielding an exact result Independent of the number of paths.

So one has to be careful with too simple test cases for convergence
checks of black box libraries. That's all.

best regards
Peter




On 26 May 2015 at 16:41, Gouthaman Balaraman
Post by Gouthaman Balaraman
Peter
Yes, the calibration with the market instruments would dictate the values
for a, and sigma. The expression gives us an estimate on selecting the
number of paths needed to obtain convergence in a Monte Carlo simulation (I
haven't seen any discussed in other references so far).
I would have to do some research on your remark about the MC simulation
without the risk neutral measure. I would expect the expression for variance
of the discount factors would be the same in other probability measures as
well. In which case, I wonder how other implementations get better
convergence. It would be nice to get some insight into this.
Goutham
-----
--
http://GouthamanBalaraman.com
--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p16591.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
QuantLib-users mailing list
https://lists.sourceforge.net/lists/listinfo/quantlib-users
svangipu
2017-05-23 02:29:25 UTC
Permalink
thank you for the insightful discussion.
I agree on the point of using a potentially different numeraire in
vendor/other libraries :)
Also on being careful about using a simple test case for comparision
purposes.
This is most likely the difference in this example imo.

A natural extension in an open-source type of conversation is how would one
go about writing a more meaningful test case for proper comparision
purposes. I am not that handy with the quantlib design/implementation
yet. Can you kindly post some comments on implementation changes for making
a proper example ie by choosing an appropriate numeraire for better results
in MC?

Thank you



--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p18293.html
Sent from the quantlib-users mailing list archive at Nabble.com.

jfritz
2017-05-16 17:43:30 UTC
Permalink
Was anyone able to find any information on good convergence from a small
number of paths (perhaps from 3rd party vendors)? In much of the research
I'm finding on implementing HW (and in my own calibration to swaptions), I
see typical ratios of a/sigma in the range of 1 to 10. Given Goutham's
comments, this would only appear to give good convergence out to about 3
years? How is anyone using these parameters to simulate paths 10, 20, 30
years out and accurately pricing cash flows them given these parameters? Any
thoughts?



--
View this message in context: http://quantlib.10058.n7.nabble.com/Matching-results-between-HW-tree-and-simulation-models-tp16399p18281.html
Sent from the quantlib-users mailing list archive at Nabble.com.
Loading...