- array_push: documentation ( source)
- end: documentation ( source)
- exp: documentation ( source)
<?php
function poisson($mu,$shift) { #returns array of poisson probabilities for scores
$x = [];
for ($i = 1 ; $i <= $shift ; $i++ ) {
array_push($x,0.0);
}
$pcdf = 0.0;
$a = exp(-1*$mu);
while ( $pcdf < 0.999999 || count($x) < 5 ) {
array_push($x,$a*($mu**(count($x)-$shift))/facdef(count($x)-$shift));
$pcdf+=end($x);
}
return $x;
}
echo poisson(1,0);
?>