Cumulative Bivariate Distribution error in the tails - BivariateCumulativeNormalDistributionWe04DP

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

Cumulative Bivariate Distribution error in the tails - BivariateCumulativeNormalDistributionWe04DP

Fabien Le Floc'h
Hello,

BivariateCumulativeNormalDistributionWe04DP is imprecise in the tails: when the correlation is high and the x,y are very high (near +/-7), the results returned can exhibit some wiggling due to numerical noise. In practice this can lead to nonsensical greeks.

A simple fix is to evaluate the univariate cumulative normal distribution where it is most precise, that is in the lower tail rather than in the upper tail, because one can achieve much higher accuracy around 0.0 vs around 1.0 with double numbers.

Attached is a small patch for BivariateCumulativeNormalDistributionWe04DP along with a unit test.

Best regards,

Fabien Le Floc'h

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

bivariatenormaltailfix.diff (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Cumulative Bivariate Distribution error in the tails - BivariateCumulativeNormalDistributionWe04DP

Smith, Dale (Norcross)

Hello,

 

Do your results show problems with double (x32) or long double (x64), or both? I am asking because I am using 64 bit Visual Studio, where long double is the same as double.

 

You should contact Graeme West about this; I’m sure he would be interested as the QuantLib algorithm is his modification of an algorithm published by Genz.

 

I am very interested in fast, accurate algorithms for the bivariate cumulative normal and t-distributions. Do you have sample code which illustrates this problem, and would you be willing to share it with me?

 

Thanks,

Dale Smith, Ph.D.

Senior Financial Quantitative Analyst

Risk & Compliance

Fiserv

Office: 678-375-5315

www.fiserv.com

 

From: Fabien Le Floc'h [mailto:[hidden email]]
Sent: Thursday, February 21, 2013 7:32 AM
To: [hidden email]
Subject: [Quantlib-users] Cumulative Bivariate Distribution error in thetails - BivariateCumulativeNormalDistributionWe04DP

 

Hello,

BivariateCumulativeNormalDistributionWe04DP is imprecise in the tails: when the correlation is high and the x,y are very high (near +/-7), the results returned can exhibit some wiggling due to numerical noise. In practice this can lead to nonsensical greeks.

A simple fix is to evaluate the univariate cumulative normal distribution where it is most precise, that is in the lower tail rather than in the upper tail, because one can achieve much higher accuracy around 0.0 vs around 1.0 with double numbers.

Attached is a small patch for BivariateCumulativeNormalDistributionWe04DP along with a unit test.

Best regards,

Fabien Le Floc'h


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Cumulative Bivariate Distribution error in the tails - BivariateCumulativeNormalDistributionWe04DP

Luigi Ballabio
In reply to this post by Fabien Le Floc'h
Thanks, Fabien.  I'll add it as soon as I get some time.

Luigi

On Thu, Feb 21, 2013 at 1:31 PM, Fabien Le Floc'h <[hidden email]> wrote:

> Hello,
>
> BivariateCumulativeNormalDistributionWe04DP is imprecise in the tails: when
> the correlation is high and the x,y are very high (near +/-7), the results
> returned can exhibit some wiggling due to numerical noise. In practice this
> can lead to nonsensical greeks.
>
> A simple fix is to evaluate the univariate cumulative normal distribution
> where it is most precise, that is in the lower tail rather than in the upper
> tail, because one can achieve much higher accuracy around 0.0 vs around 1.0
> with double numbers.
>
> Attached is a small patch for BivariateCumulativeNormalDistributionWe04DP
> along with a unit test.
>
> Best regards,
>
> Fabien Le Floc'h
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Cumulative Bivariate Distribution error in the tails - BivariateCumulativeNormalDistributionWe04DP

Luigi Ballabio
In reply to this post by Fabien Le Floc'h
Hi Fabien,
    I've applied your patch to the repository.

Thanks,
    Luigi


On Thu, Feb 21, 2013 at 1:31 PM, Fabien Le Floc'h <[hidden email]> wrote:

> Hello,
>
> BivariateCumulativeNormalDistributionWe04DP is imprecise in the tails: when
> the correlation is high and the x,y are very high (near +/-7), the results
> returned can exhibit some wiggling due to numerical noise. In practice this
> can lead to nonsensical greeks.
>
> A simple fix is to evaluate the univariate cumulative normal distribution
> where it is most precise, that is in the lower tail rather than in the upper
> tail, because one can achieve much higher accuracy around 0.0 vs around 1.0
> with double numbers.
>
> Attached is a small patch for BivariateCumulativeNormalDistributionWe04DP
> along with a unit test.
>
> Best regards,
>
> Fabien Le Floc'h
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users