PHI 3CW "30 July 2007" "mathcw-1.00"

Table of contents


NAME

phif, phi, phil, phiw, phiq, phill, phidf, phid, phidl, phidll - cumulative distribution function of the standard normal distribution

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern float phif (float x);

extern double phi (double x);

extern long double phil (long double x);

extern __float80 phiw (__float80 x);

extern __float128 phiq (__float128 x);

extern long_long_double phill (long_long_double x);

extern decimal_float phidf (decimal_float x);

extern decimal_double phid (decimal_double x);

extern decimal_long_double phidl (decimal_long_double x);

extern decimal_long_long_double phidll (decimal_long_long_double x);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

For the standard normal distribution, compute the cumulative distribution function defined by

phi(x) = (1/sqrt(2pi)) integral(t = -infinity:x) exp((-t**2)/2) dt
       = 1 - phic(x).
This is the area under the curve of the standard normal distribution to the left of x, sometimes called the lower-tail area. In mathematical text, phi(x) is written with an uppercase Greek phi: \(*F(x).

If a random variable x has a normal distribution with mean \(*m (mu) and standard deviation \(*s (sigma), then the translated and scaled variable r = (x - \(*m)/\(*s has a standard normal distribution. The probability that x lies in the interval [a, b] is then given by

P(a <= x <= b) = \(*F((b - \(*m)/\(*s) - \(*F((a - \(*m)/\(*s).
Similarly, for the standard normal distribution, the probability that r lies in the interval [c, d] is
P(c <= r <= d) = \(*F(d) - \(*F(c).
From this, it follows that the probability that a normally-distributed random value x exceeds the mean by at least n standard deviations is therefore given by
P((\(*m + n\(*s) <= x <= \(if) = \(*F(\(if) - \(*F(((\(*m + n\(*s) - \(*m)/\(*s)
                 = 1 - \(*F(((\(*m + n\(*s) - \(*m)/\(*s)
                 = \(*F_c(((\(*m + n\(*s) - \(*m)/\(*s)
                 = \(*F_c(n).
That probability is independent of the mean and standard deviation, and drops off rapidly, as this table illustrates:

     n   0    1      2       3        4         5         6
\(*F_c(n)  0.5  0.159  0.0228  0.00135  3.17e-05  2.87e-07  9.87e-10

These data lead to the handy rules of thumb that only about one in a thousand normally-distributed random values lies more than three standard deviations from the mean, and fewer than one in a million lie more than five standard deviations away.

Caution: While the two functions share the simple relation phi(x) + phic(x) = 1, it is only accurate to compute the larger from the smaller.


RETURN VALUES

If x is finite or Infinity, return the value of the cumulative distribution function of the standard normal distribution function. The value lies in [0,1] for x in [-Infinity, +Infinity].

ERRORS

For NaN arguments, the returned value is a quiet NaN, and errno is set to EDOM.

SEE ALSO

erf(3CW), erfc(3CW), ierf(3CW), ierfc(3CW), iphi(3CW), iphic(3CW), phic(3CW).