| |
Navigator v2.0 & up or Internet Explorer v3.02
& up is required to utilize the page on a
PC-compatible. If you can't use this page, consider
upgrading your browser.
Common properties.
- After changing the value in one box, you must
click outside the box to start the script that
solves for the other box.
- A non-numeric entry into either box will result
in an error. If this occurs, merely accept the
dialogue box describing the error and try again.
(I admit it. . .it's rather kludgy. If/when I
have time I'll include a "catch" for
text in entries and display an appropriate
message.)
Enter z, program returns
area under curve over region left of z.
- Enter any number z in
the left-hand box. In the right-hand box the
program returns the area under the standard
normal curve over the region left of z
. That is, for input z,
the result returned is
- Results are displayed to the nearest 0.00001
(one-hundred-thousandth). The result will not be
identically equal to tabled values that are
displayed with less (typically 0.0001) accuracy.
- Technically the algorithm for computing this area
works for any numeric input. However, the
computing time soars for z
large in magnitude (see notes on the algorithm). Therefore, the
program has a sieve that weeds out values | z
| > 4.26489. In such cases the tail area is
less than 0.00001.
Enter area under curve over region left of z,
program returns z.
- Valid input in the right-hand box is any number
between (but not including) 0 and 1. Upon valid
input of the area under the standard normal curve
to the left of z (where
z is now unknown, but
the area is known) the program returns the value
of z. That is, if p
is input, the result returned is

- Results are displayed to the nearest 0.001
(one-thousandth). The script finds a solution for
every valid input. By way of contrast, typically
one must "use the closest value" or
interpolate when using tradiitional tables.
- For inputs less than 0.00001 or greater than
0.99999 the result is reported as either
"< - 4.26489" or ">
4.26489", respectively. This, again, is done
to prohibit long waits for computation.
The code is written in JavaScript.
Assuming | z | < 4.26489
(for other cases read the documentation),
I use a Taylor series to compute the cumulative
distribution function for the standard normal:

where (2k + 1)!! = (2k + 1) × (2k
- 1) × (2k - 3) × . . . × 5 × 3 × 1. Of
course, I don't sum to infinity (that's way too large); I
truncate the accumulation of the sum when successive
partial sums are sufficiently close. This approximation
works for all input, but when extremes are input it can
require a huge number of iterations before converging.
That's why I handle | z | >
4.26489 differently.
Solving the inverse function is trickier. Most direct
approaches are complex and require considerable amounts
of code. So, when a legitimate area is input, I use a
look-up table to whittle the answer down to a small
region. (In fact, I've constructed the look-up table to
"anticipate" certain input values--if the input
matches a value in the input table then all computation
is avoided.) Once I've got the answer in a small region
(between, say, a and b) I use a binary
search algorthm to shrink this region. This amounts to a divide
and conquer strategy. The Taylor approximation above
is used to check each successive "pared-down"
region. When the region is sufficiently small, I've got
an answer.
|
|