Using the Error Function (Erf) Instead


These areas can also be found by using the "Error Function" or "Erf", which is the area starting at z=0 when σ = 1/2^(1/2).
(Internally this is what Mathematica does, treating Erf[x] as a built-in like Sin[x].)
So the integral of the standard normal distribution from 0 to z is also given by 0.5 Erf[z/2^(1/2)].
For example, here is the area under the normal curve from z=0 to z=1, calculated to 20 places, two ways.

N[(areaLeftZNormal[1] - areaLeftZNormal[0]), 20]

0.34134474606854294859

N[Erf[1/2^(1/2)]/2, 20]

0.34134474606854294859

Or, going the other way

N[Erf[1], 20]

0.84270079294971486934

N[2 (CDF[NormalDistribution[0, 1/2^(1/2)], 1] - 1/2), 20]

0.84270079294971486934

Mathematica also defines Erfc[z] = 1 - Erf[z] (Erf complement) which gives us another way to define f[z] = areaLeftOfZNormal[z].

f[z_] := Erfc[-z/2^(1/2)]/2

Plot[f[z], {z, -3, 3}]

[Graphics:../HTMLFiles/normal_62.gif]

⁃Graphics⁃

Inverting this gives

p = f[z] = Erfc[-z/2^(1/2)]/2  ,   where 0≤p≤1, and - ∞≤z≤∞  z = fInv[p] = -2^(1/2) InverseErfc[2p]

fInv[p_] := -2^(1/2) InverseErfc[2p]

Plot[fInv[p], {p, 0, 1}]

[Graphics:../HTMLFiles/normal_67.gif]

⁃Graphics⁃

So the total probability under the standard (μ=0,σ=1) Normal curve, for z ≤ 1 is

RowBox[{f, [, 1., ]}]

0.841345

And the value of z for which the probability is 0.841345 is

RowBox[{fInv, [, 0.841345, ]}]

1.


Created by Mathematica  (October 2, 2003)