Missing standard deviation calculated from a population (division by N or by N-1): http://en.wikipedia.org/wiki/Standard_deviation
stats_standard_deviation
(PECL stats:1.0.0-1.0.2)
stats_standard_deviation — Returns the standard deviation
Descrizione
float stats_standard_deviation
( array $a
[, bool $sample
] )
Avviso
Questa funzione, al momento non è documentata; è disponibile soltanto la lista degli argomenti.
Elenco dei parametri
- a
-
- sample
-
Valori restituiti
stats_standard_deviation
kotecky O hotmail o com
24-Oct-2006 02:50
24-Oct-2006 02:50
mightymrj at hotmail dot com
22-May-2006 05:52
22-May-2006 05:52
Here's a couple functions I made that easily calculate the standard deviation.
function average($array){
$sum = array_sum($array);
$count = count($array);
return $sum/$count;
}
//The average function can be use independantly but the deviation function uses the average function.
function deviation ($array){
$avg = average($array);
foreach ($array as $value) {
$variance[] = pow($value-$avg, 2);
}
$deviation = sqrt(average($variance));
return $deviation;
}
I hope this is useful
