NOThanks but the problem is the ERF number. I'm using 0.842700793 which multiplied by 1/sqrt(2) = 0.59... and not the 0.682689 that you have.
erf is a function.
you want erf( 1/sqrt(2) )
you have used ( erf( 1) ) /sqrt(2)
NOThanks but the problem is the ERF number. I'm using 0.842700793 which multiplied by 1/sqrt(2) = 0.59... and not the 0.682689 that you have.
return 0.5*std::erfc(-x / std::sqrt(2.0));
recall the last sentence.Sure, but see how I do it with erfc. i.e. N() is computed in terms of ERF.I've already replicated ERF via Abramowitz & Stegun 7.1.5 but ERF does not equal NORM.DIST(x,mean,standard_dev,cumulative).
=NORM.DIST(1,0,1,TRUE) = 0.84134475
=ERF (0,1) = 0.84270079
I checked the stuffThanks but ERF or ERFC that doesn't replicate =NORM.DIST(1,0,1,TRUE) = 0.84134475 - unless I'm missing something here.
Indeed. I spent some time on thisDon't forget the paper "Better approximations to cumulative normal functions" by Graeme West. If I remember correctly, the double precision implementation matches Excel exactly.
Cheers,
Jordy
double N(double x)
{ // aka CdfN(x)
return 0.5*std::erfc(-x / std::sqrt(2.0));
}
There is a closed form approximation. Approximation isn't always bad. It's like when you deal with duration and convexity. We don't traditionally go beyond convexity, but it is possible to get a more accurate estimate. It's a taylor series. There is an ERF function. The closed form equation extends out until the amount is meaningless. That's probably what Excel does.NORM.DIST(x,mean,standard_dev,cumulative). When cumulative is TRUE this function returns the cumulative density function which is the normal density function integrated from negative infinity to x.
I understand that there is no closed form solution for integrating the NDF but does anyone know which methodology Excel uses? I've tried series approximations, continuous fractions and polynomials but get slightly different values .