NORMALPROB inputVector [meanNumber stdDevNumber] resultVariable

Given a set of "x" or "z" values in the inputVector, this command computes the normal cumulative probability (the area under the normal distribution curve) from negative infinity to each x or z element's value of inputVector, putting the result in resultVariable.

If the meanNumber and stdDevNumber are absent, then the elements of inputVector are assumed to be "z" values, that is, they are already adjusted to a mean of zero and a standard deviation of 1.0.

If meanNumber and stDevNumber are present, then the elements of inputVector are taken to be "x" values, that is, they will be converted to "z" values during the computation using the given mean and standard deviation according to the formula

zi = Mean(X) - xi / stdDev(X).

where X represents all x values and xi represents any one of the values of the input vector.


Implementation note: The implementation of this command is based upon algorithm 5666 for the error function, from: Hart, J.F. et al, Computer Approximations, Wiley 1968. The FORTRAN programmer was Alan Miller. The documentation in the FORTRAN code claims that the function is "accurate to 1.0E-15." Steve Verrill translated the FORTRAN code (the March 30, 1986 version) into Java. This translation was performed on January 10, 2001.


The following program illustrates the operation of the NORMALPROB command.

NORMALPROB (-1 0 1) probabilities1            'inputs are z values
NORMALPROB (90 100 110) 100 10 probabilities2 'inputs are x values
PRINT probabilities1 probabilities2

Here is the output of the above program:

probabilities1: (0.15865525393145702 0.5 0.841344746068543)
probabilities2: (0.15865525393145702 0.5 0.841344746068543)

To compute the probability over any range, you can use this subroutine:

'Computes the probability that a normal variable will be
'found in the range between lowLimit and highLimit for the
'given mean and standard deviation.
NEWCMD NORMALPROB_RANGE lowlimit highLimit mean stdDev prob ?"Computes Normal probability over a range"
   NORMALPROB lowLimit mean stdDev low
   NORMALPROB highLimit mean stdDev high
   SUBTRACT high low prob