bivariate student cdf?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

bivariate student cdf?

Michal Kaut
Hello,

I am wandering whether you (the QuantLib team) would be interested in a
code for bivariate student cdf?
I needed it for my code and since I did not find any implementation with
a suitable license, I have implemented it myself.
I did it in my free time, using formulas from a published paper (from
1954), so I have all rights to the code.
I checked the code against another library (in Matlab) and it gives the
same results.

At the moment, the code uses standard C/C++ types (double etc), but it
should not be a big problem to QuantLib-tify it.

My question is, do you have use for this (bivariate Student cdf) in
QuanLib? And if yes, what is the next step? (I have to admit I have very
little experience in contributing code to projects.)


Regards,
Michal

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: bivariate student cdf?

Luigi Ballabio

Hello,
    if you have use for it, then we probably have, too.  :)
You can either post the code here, or (if you're familiar with GitHub) send me a pull request.

Luigi

On Apr 15, 2014 9:34 PM, "Michal Kaut" <[hidden email]> wrote:
Hello,

I am wandering whether you (the QuantLib team) would be interested in a
code for bivariate student cdf?
I needed it for my code and since I did not find any implementation with
a suitable license, I have implemented it myself.
I did it in my free time, using formulas from a published paper (from
1954), so I have all rights to the code.
I checked the code against another library (in Matlab) and it gives the
same results.

At the moment, the code uses standard C/C++ types (double etc), but it
should not be a big problem to QuantLib-tify it.

My question is, do you have use for this (bivariate Student cdf) in
QuanLib? And if yes, what is the next step? (I have to admit I have very
little experience in contributing code to projects.)


Regards,
Michal

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: bivariate student cdf?

Michal Kaut
Dear Luigi,

please find the code attached.
(I have only limited experience with GitHub and, moreover, the code
needs some QuantLib-ization before it can be added to the library..)

I have also included a short note with a link to the original paper and
explaining some details of the implementation.

By the way, here is the link with the only other implementation of the
bivariate student cdf, which I used for
checking:http://www.math.wsu.edu/math/faculty/genz/software/software.html.
(They are based on the same paper, but the codes are GPL.)

I hope you find the code useful.

Michal


On 15/04/14 21:40, Luigi Ballabio wrote:

> Hello,
>      if you have use for it, then we probably have, too.  :)
> You can either post the code here, or (if you're familiar with GitHub)
> send me a pull request.
>
> Luigi
>
> On Apr 15, 2014 9:34 PM, "Michal Kaut" <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello,
>
>     I am wandering whether you (the QuantLib team) would be interested in a
>     code for bivariate student cdf?
>     I needed it for my code and since I did not find any implementation with
>     a suitable license, I have implemented it myself.
>     I did it in my free time, using formulas from a published paper (from
>     1954), so I have all rights to the code.
>     I checked the code against another library (in Matlab) and it gives the
>     same results.
>
>     At the moment, the code uses standard C/C++ types (double etc), but it
>     should not be a big problem to QuantLib-tify it.
>
>     My question is, do you have use for this (bivariate Student cdf) in
>     QuanLib? And if yes, what is the next step? (I have to admit I have very
>     little experience in contributing code to projects.)
>
>
>     Regards,
>     Michal
>
>     ------------------------------------------------------------------------------
>     Learn Graph Databases - Download FREE O'Reilly Book
>     "Graph Databases" is the definitive new guide to graph databases and
>     their
>     applications. Written by three acclaimed leaders in the field,
>     this first edition is now available. Download your free book today!
>     http://p.sf.net/sfu/NeoTech
>     _______________________________________________
>     QuantLib-dev mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

bivariate_student_cdf.tar.bz2 (178K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: bivariate student cdf?

krishtr.quant@gmail.com
In reply to this post by Michal Kaut
Hi Luigi,

I had a question in this context as well. Like Michal, I have little experience contributing to projects. My question is - how can we know what we can contribute? Like bugs, feature requests etc. Apologies, if this has been covered elsewhere.

Before C++11, which now supports normal distribution random number generators, I wrote code to generate these myself (Polar Marsaglia algorithm etc). Would this be of interest to Quantlib project? Please bear with my questions as I'm a newbie.

Regards,

-Krishnan

----- Reply message -----
From: "Luigi Ballabio" <[hidden email]>
To: "Michal Kaut" <[hidden email]>
Cc: "QuantLib developers" <[hidden email]>
Subject: [Quantlib-dev] bivariate student cdf?
Date: Tue, Apr 15, 2014 20:40

Hello,
    if you have use for it, then we probably have, too.  :)
You can either post the code here, or (if you're familiar with GitHub) send me a pull request.

Luigi

On Apr 15, 2014 9:34 PM, "Michal Kaut" <[hidden email]> wrote:
Hello,

I am wandering whether you (the QuantLib team) would be interested in a
code for bivariate student cdf?
I needed it for my code and since I did not find any implementation with
a suitable license, I have implemented it myself.
I did it in my free time, using formulas from a published paper (from
1954), so I have all rights to the code.
I checked the code against another library (in Matlab) and it gives the
same results.

At the moment, the code uses standard C/C++ types (double etc), but it
should not be a big problem to QuantLib-tify it.

My question is, do you have use for this (bivariate Student cdf) in
QuanLib? And if yes, what is the next step? (I have to admit I have very
little experience in contributing code to projects.)


Regards,
Michal

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: bivariate student cdf?

Luigi Ballabio
In reply to this post by Michal Kaut
Thanks, Michal. Do you have any test cases for the function?

Luigi


On Tue, Apr 15, 2014 at 10:06 PM, Michal Kaut <[hidden email]> wrote:
Dear Luigi,

please find the code attached.
(I have only limited experience with GitHub and, moreover, the code needs some QuantLib-ization before it can be added to the library..)

I have also included a short note with a link to the original paper and explaining some details of the implementation.

By the way, here is the link with the only other implementation of the bivariate student cdf, which I used for checking:http://www.math.wsu.edu/math/faculty/genz/software/software.html.
(They are based on the same paper, but the codes are GPL.)

I hope you find the code useful.

Michal



On 15/04/14 21:40, Luigi Ballabio wrote:
Hello,
     if you have use for it, then we probably have, too.  :)
You can either post the code here, or (if you're familiar with GitHub)
send me a pull request.

Luigi

On Apr 15, 2014 9:34 PM, "Michal Kaut" <[hidden email]
<mailto:[hidden email]>> wrote:

    Hello,

    I am wandering whether you (the QuantLib team) would be interested in a
    code for bivariate student cdf?
    I needed it for my code and since I did not find any implementation with
    a suitable license, I have implemented it myself.
    I did it in my free time, using formulas from a published paper (from
    1954), so I have all rights to the code.
    I checked the code against another library (in Matlab) and it gives the
    same results.

    At the moment, the code uses standard C/C++ types (double etc), but it
    should not be a big problem to QuantLib-tify it.

    My question is, do you have use for this (bivariate Student cdf) in
    QuanLib? And if yes, what is the next step? (I have to admit I have very
    little experience in contributing code to projects.)


    Regards,
    Michal

    ------------------------------------------------------------------------------
    Learn Graph Databases - Download FREE O'Reilly Book
    "Graph Databases" is the definitive new guide to graph databases and
    their
    applications. Written by three acclaimed leaders in the field,
    this first edition is now available. Download your free book today!
    http://p.sf.net/sfu/NeoTech
    _______________________________________________
    QuantLib-dev mailing list
    [hidden email]
    <mailto:[hidden email]>
    https://lists.sourceforge.net/lists/listinfo/quantlib-dev




--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: bivariate student cdf?

Luigi Ballabio
In reply to this post by krishtr.quant@gmail.com
Hello Krishnan,
    we have a number of generators in the library already. Do yours add any particular features?

We don't have clean-cut rules on contributions. If I were to try and write some guidelines: contributions of new instruments and/or models are obviously ok. Math code should have some use case in the rest of the library; Michal's is somewhat borderline (no actual use case yet) but it's an extension of the 1-D case and I can imagine it being used for some simulation. But in general, I'm not very selective and I tend to accept stuff (which sometimes leads to entire directories being in the library and not being used at all as far as I know, which is the reason I'm trying to filter a bit more these days).

As for bugs: known ones are filed at <http://sourceforge.net/p/quantlib/bugs/> Some of those are quite old, so it would be of help if someone were to go through them, check if they can still be reproduced, and let me know so I can close some of them. We used to have a feature-request tracker, but it was rather useless; as a rule, potential contributors stick to coding if something is useful to them, but lose interest quickly if the feature was requested by someone else...

One thing that might be needed are more tests. Of course this falls into the feature-request problem I just wrote about. But if someone starts using some feature of the library for their work, then it would be useful to all parties involved to add some test cases.

I hope this starts to answer your question.

Later,
    Luigi




On Wed, Apr 16, 2014 at 12:19 AM, [hidden email] <[hidden email]> wrote:
Hi Luigi,

I had a question in this context as well. Like Michal, I have little experience contributing to projects. My question is - how can we know what we can contribute? Like bugs, feature requests etc. Apologies, if this has been covered elsewhere.

Before C++11, which now supports normal distribution random number generators, I wrote code to generate these myself (Polar Marsaglia algorithm etc). Would this be of interest to Quantlib project? Please bear with my questions as I'm a newbie.

Regards,

-Krishnan

----- Reply message -----
From: "Luigi Ballabio" <[hidden email]>
To: "Michal Kaut" <[hidden email]>
Cc: "QuantLib developers" <[hidden email]>
Subject: [Quantlib-dev] bivariate student cdf?
Date: Tue, Apr 15, 2014 20:40

Hello,
    if you have use for it, then we probably have, too.  :)
You can either post the code here, or (if you're familiar with GitHub) send me a pull request.

Luigi

On Apr 15, 2014 9:34 PM, "Michal Kaut" <[hidden email]> wrote:
Hello,

I am wandering whether you (the QuantLib team) would be interested in a
code for bivariate student cdf?
I needed it for my code and since I did not find any implementation with
a suitable license, I have implemented it myself.
I did it in my free time, using formulas from a published paper (from
1954), so I have all rights to the code.
I checked the code against another library (in Matlab) and it gives the
same results.

At the moment, the code uses standard C/C++ types (double etc), but it
should not be a big problem to QuantLib-tify it.

My question is, do you have use for this (bivariate Student cdf) in
QuanLib? And if yes, what is the next step? (I have to admit I have very
little experience in contributing code to projects.)


Regards,
Michal

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: bivariate student cdf?

Michal Kaut
In reply to this post by Luigi Ballabio
Luigi,

I have a small test case, you can get it from https://db.tt/eYcPFP15 
(too big to send by email).
In addition, I have included a slightly updated version of the
implementation note.

There are four tests in the file:
1. Prints an equivalent of Table 1 from the paper I am using for
formulas (needs manual comparison with the values in the table).

2. Ditto for Table 2.

Both the tables include only tables on the diagonal (y=x), so this is
not a sufficient test.

3. Compare results of cdf with dof = 10000 to normal distribution, for a
range of correlations. This uses the bivariate normal cdf from QuantLib.
The reasoning behind the test is that since normal is the limit case of
student with dof equal to infinity, dof=10000 should be enough for the
two to be virtually equal.

4. Compare results to the values generated by a Matlab file bvtl.m from
http://www.math.wsu.edu/math/faculty/genz/software/software.html.
Note that I have included not only the generated tables, but also bvtl.m
and my script for generating the tables - this is only for you to check
what I did, bvtl.m cannot be distributed with QuantLib as it is under GPL.
The test code expects the comparison tables to reside in folder ./test,
though this is easily changed.

Hope this helps.

Regards,
Michal



On 16/04/14 15:18, Luigi Ballabio wrote:

> Thanks, Michal. Do you have any test cases for the function?
>
> Luigi
>
>
> On Tue, Apr 15, 2014 at 10:06 PM, Michal Kaut <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Dear Luigi,
>
>     please find the code attached.
>     (I have only limited experience with GitHub and, moreover, the code
>     needs some QuantLib-ization before it can be added to the library..)
>
>     I have also included a short note with a link to the original paper
>     and explaining some details of the implementation.
>
>     By the way, here is the link with the only other implementation of
>     the bivariate student cdf, which I used for
>     checking:http://www.math.wsu.__edu/math/faculty/genz/__software/software.html
>     <http://www.math.wsu.edu/math/faculty/genz/software/software.html>.
>     (They are based on the same paper, but the codes are GPL.)
>
>     I hope you find the code useful.
>
>     Michal
>
>
>
>     On 15/04/14 21:40, Luigi Ballabio wrote:
>
>         Hello,
>               if you have use for it, then we probably have, too.  :)
>         You can either post the code here, or (if you're familiar with
>         GitHub)
>         send me a pull request.
>
>         Luigi
>
>         On Apr 15, 2014 9:34 PM, "Michal Kaut" <[hidden email]
>         <mailto:[hidden email]>
>         <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>
>              Hello,
>
>              I am wandering whether you (the QuantLib team) would be
>         interested in a
>              code for bivariate student cdf?
>              I needed it for my code and since I did not find any
>         implementation with
>              a suitable license, I have implemented it myself.
>              I did it in my free time, using formulas from a published
>         paper (from
>              1954), so I have all rights to the code.
>              I checked the code against another library (in Matlab) and
>         it gives the
>              same results.
>
>              At the moment, the code uses standard C/C++ types (double
>         etc), but it
>              should not be a big problem to QuantLib-tify it.
>
>              My question is, do you have use for this (bivariate Student
>         cdf) in
>              QuanLib? And if yes, what is the next step? (I have to
>         admit I have very
>              little experience in contributing code to projects.)
>
>
>              Regards,
>              Michal
>
>
>         ------------------------------__------------------------------__------------------
>              Learn Graph Databases - Download FREE O'Reilly Book
>              "Graph Databases" is the definitive new guide to graph
>         databases and
>              their
>              applications. Written by three acclaimed leaders in the field,
>              this first edition is now available. Download your free
>         book today!
>         http://p.sf.net/sfu/NeoTech
>              _________________________________________________
>              QuantLib-dev mailing list
>         [hidden email]
>         <mailto:[hidden email]>
>              <mailto:[hidden email]
>         <mailto:[hidden email]>>
>         https://lists.sourceforge.net/__lists/listinfo/quantlib-dev
>         <https://lists.sourceforge.net/lists/listinfo/quantlib-dev>
>
>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

attachment0 Download Attachment