You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Pavel Ryzhov <pa...@gmail.com> on 2010/12/24 16:38:21 UTC

[math] Monte Carlo engine with 1D path

So,

I see that Monte Carlo is on Math wish list. So I've done a quite simple MC engine that uses 1D path generated by underlying stochastic process. It should be easy to extend it to multidimensional paths but it is not in my plans yet.

The implementation is inspired by Quantlib project (http://quantlib.org/index.shtml) but I tried to keep it as far as possible from financial slang.

Do we wish this feature in 3.0?

Pavel



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Monte Carlo engine with 1D path

Posted by Phil Steitz <ph...@gmail.com>.
On Sun, Dec 26, 2010 at 6:59 AM, Pavel Ryzhov <pa...@gmail.com>wrote:

> Hi Phil,
>
> The engine I wrote goes as follows:
> 1. Generates N samples (paths) of Ito process with given drift and
> diffusion. It uses simple Euler discretization on equally spaced time scale.
> 2. For each path evaluate some path function and provide this value to
> SummaryStatistics.
>
> The usage of SummaryStatistics is rather questionable but it seems to be
> reasonable for the beginning. Most prob, I will abstract it to some
> interface and supply default implementation based on SummaryStatistics
> class.
>
> Currently implemented specific stochastic processes are Geometric Brownian
> Motion (http://en.wikipedia.org/wiki/Geometric_Brownian_motion) and
> Ornstein-Uhlenbeck process (
> http://en.wikipedia.org/wiki/Ornstein–Uhlenbeck_process<http://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process>).
> They are used for engine tests as they have analytically expressed first
> moments.
>
> The inspirational point of quantlib project is that I tried to use it for
> my purposes and it looks like overkill for my simple ideas. Thus I end up
> with writing my own engine.
>
>
OK.  I see what you have in mind now.  Open a JIRA and attach some code and
we can talk about the API.

Thanks!

Phil

> Regards,
> Pavel
>
> On Dec 24, 2010, at 19:10 PM, Phil Steitz wrote:
>
> > On Fri, Dec 24, 2010 at 10:38 AM, Pavel Ryzhov <pavel.ryzhov@gmail.com
> >wrote:
> >
> >> So,
> >>
> >> I see that Monte Carlo is on Math wish list. So I've done a quite simple
> MC
> >> engine that uses 1D path generated by underlying stochastic process. It
> >> should be easy to extend it to multidimensional paths but it is not in
> my
> >> plans yet.
> >>
> >> The implementation is inspired by Quantlib project (
> >> http://quantlib.org/index.shtml) but I tried to keep it as far as
> possible
> >> from financial slang.
> >>
> >> Do we wish this feature in 3.0?
> >>
> >> Can you describe in a little more detail what you have in mind?
> >
> > Phil
> >
> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: dev-help@commons.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: [math] Monte Carlo engine with 1D path

Posted by Pavel Ryzhov <pa...@gmail.com>.
Hi Phil, 

The engine I wrote goes as follows:
1. Generates N samples (paths) of Ito process with given drift and diffusion. It uses simple Euler discretization on equally spaced time scale.
2. For each path evaluate some path function and provide this value to SummaryStatistics.

The usage of SummaryStatistics is rather questionable but it seems to be reasonable for the beginning. Most prob, I will abstract it to some interface and supply default implementation based on SummaryStatistics class.

Currently implemented specific stochastic processes are Geometric Brownian Motion (http://en.wikipedia.org/wiki/Geometric_Brownian_motion) and Ornstein-Uhlenbeck process (http://en.wikipedia.org/wiki/Ornstein–Uhlenbeck_process). They are used for engine tests as they have analytically expressed first moments.

The inspirational point of quantlib project is that I tried to use it for my purposes and it looks like overkill for my simple ideas. Thus I end up with writing my own engine.

Regards,
Pavel

On Dec 24, 2010, at 19:10 PM, Phil Steitz wrote:

> On Fri, Dec 24, 2010 at 10:38 AM, Pavel Ryzhov <pa...@gmail.com>wrote:
> 
>> So,
>> 
>> I see that Monte Carlo is on Math wish list. So I've done a quite simple MC
>> engine that uses 1D path generated by underlying stochastic process. It
>> should be easy to extend it to multidimensional paths but it is not in my
>> plans yet.
>> 
>> The implementation is inspired by Quantlib project (
>> http://quantlib.org/index.shtml) but I tried to keep it as far as possible
>> from financial slang.
>> 
>> Do we wish this feature in 3.0?
>> 
>> Can you describe in a little more detail what you have in mind?
> 
> Phil
> 
> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Monte Carlo engine with 1D path

Posted by Phil Steitz <ph...@gmail.com>.
On Fri, Dec 24, 2010 at 10:38 AM, Pavel Ryzhov <pa...@gmail.com>wrote:

> So,
>
> I see that Monte Carlo is on Math wish list. So I've done a quite simple MC
> engine that uses 1D path generated by underlying stochastic process. It
> should be easy to extend it to multidimensional paths but it is not in my
> plans yet.
>
> The implementation is inspired by Quantlib project (
> http://quantlib.org/index.shtml) but I tried to keep it as far as possible
> from financial slang.
>
> Do we wish this feature in 3.0?
>
> Can you describe in a little more detail what you have in mind?

Phil


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>