Reputation:
Is there a php function for the standard normal cumulative distribution function?
I can't find one.
A plugin/library is great too.
Please show me where it is.
Many thanks in advance!
stats_cdf_normal
Gives Fatal error: Call to undefined function stats_cdf_normal()
Upvotes: 2
Views: 4487
Reputation: 5428
There's an undocumented stats_cdf_normal()
function in the PECL stats package.
Check out the note at the bottom of this page: http://www.php.net/manual/en/ref.stats.php
oliver at •••••••• dot com:
There are some undocumented functions in this extension, eg I found the following by reading the DCDFLIB docs and some trial and error:
<?php
/**
* stats_cdf_normal($x, $mean, $sd, 1)
* @return float cumulative probablity
*/
echo stats_cdf_normal(1.96, 0, 1, 1) . "\n";
/**
* stats_cdf_normal($p, $mean, $sd, 2)
* @return float x which bounds cumulative probalility $p
*/
echo stats_cdf_normal(0.975, 0, 1, 2) . "\n";
// less useful
// echo stats_cdf_normal(0.4,0.5,0.6,3) . "\n";
// echo stats_cdf_normal(0.4,0.5,0.6,4) . "\n";
?>
Upvotes: 4