Source for file f_cumulative_normal_dist.php
Documentation is available at f_cumulative_normal_dist.php
// Returns the standard normal cumulative distribution
// ---------------------------------------
// Load tabulated values in an array
include "ndist_tabulated.php" ;
// Discriminate upon the absolute value, then the sign of $x
if ( abs( $x ) >= 3.09 ) {
// find higher boundary (next highest value with 2 decimals)
$output = $values[$x1] + ( $values[$x2] - $values[$x1] )/0.01* ( $x - $x1 ) ;
// Returns the inverse standard normal cumulative distribution ( 0<y<1 )
// ---------------------------------------
// Load tabulated values in an array
include "ndist_tabulated.php" ;
// Discriminate upon whether $y is between 0 and 1, then upon its position relative to 0.5
// find the largest index which value is smaller than $y:
// filter array for values higher than $y
while ( list ( $key, $value ) = each( $values ) ) {
$smaller[$key] = $value ;
// order $values in decreasing terms of the $values
krsort( $smaller, SORT_NUMERIC ) ;
$x1 = (string) key( $smaller ) ;
$x2 = (string) ( $x1+0.01 ) ;
$output = $x1 + ( $y - $values[$x1] )/ ( $values[$x2] - $values[$x1] )*0.01 ;
} else { // meaning $x between 0.5 and 1
Documentation generated on Mon, 11 Mar 2019 15:39:17 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|