Professional Documents
Culture Documents
.2 0.8 0.4 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6 4.0
- -
normal
as from the book
Standard Normal Cumulative Distribution Function
Abromowitz and Stegun approximation
We also show h
0.6000 built-in functio
0.4000
0.2000
0.0000
.0 .6 .2 .8 .4 .0 .6 .2 .8 .4 .0 .4 .8 .2 .6 .0 .4 .8 .2 .6 .0
-4 -3 -3 -2 -2 -2 -1 -1 -0 -0 0 0 0 1 1 2 2 2 3 3 4
This sheet shows how to calculate the standard normal
cumulative distribution function two different ways.
5 5 5 5 5 5 5 5 5 5 5 5 9
42 .47 .52 .57 .62 .67 .72 .77 .82 .87 .92 .97 .99
0 0 0 0 0 0 0 0 0 0 0 0
erse of the standard
wo different ways.
of the normal
e some well known
roximations here. C#
"code" tab.
if (z < 0.0)
{
double t = 1.0/(1.0 - p*z);
return (c*Math.Exp(-z*z/2.0)*t*(t*(t*(t*(t*b5 + b4) + b3) + b2) + b1));
}
else
{
double t = 1.0/(1.0 + p*z);
return (1.0 - c*Math.Exp(-z*z/2.0)*t*(t*(t*(t*(t*b5 + b4) + b3) + b2) + b1));
}
}
/// <summary>
/// Inverse Cumulative Standard Normal Dist
/// </summary>
public static double InvCSND(double p)
{
const double a1 = -39.6968302866538;
const double a2 = 220.946098424521;
const double a3 = -275.928510446969;
const double a4 = 138.357751867269;
const double a5 = -30.6647980661472;
const double a6 = 2.50662827745924;
const double b1 = -54.4760987982241;
const double b2 = 161.585836858041;
const double b3 = -155.698979859887;
const double b4 = 66.8013118877197;
const double b5 = -13.2806815528857;
const double c1 = -7.78489400243029E-03;
const double c2 = -0.322396458041136;
const double c3 = -2.40075827716184;
const double c4 = -2.54973253934373;
const double c5 = 4.37466414146497;
const double c6 = 2.93816398269878;
const double d1 = 7.78469570904146E-03;
const double d2 = 0.32246712907004;
const double d3 = 2.445134137143;
const double d4 = 3.75440866190742;
const double pLow = 0.02425;
const double pHigh = 1 - pLow;
double q;
if (p < 0 || p > 1)
{
return double.NaN;
}
if (p < pLow)
{
q = Math.Sqrt(-2 * Math.Log(p));
return (((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q
}
if (p <= pHigh)
{
q = p - 0.5;
double r = q * q;
return (((((a1 * r + a2) * r + a3) * r + a4) * r + a5) * r + a6) * q / (((((b1 * r + b2) * r + b3) * r + b4) *
}
q = Math.Sqrt(-2 * Math.Log(1 - p));
return -(((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q +
}
+ d2) * q + d3) * q + d4) * q + 1);