You are here: Re: stats_standard_deviation « PHP Programming Language « IT news, forums, messages
Re: stats_standard_deviation

Posted by Erwin Moller on 10/05/06 15:20

Jeff Gardner wrote:

> Does anyone have more details on stats_standard_deviation than the
> manual provides?

Hi Jeff,

The describtion is very bad indeed.

Why use an undocumented (bad documented) function for such a simple thing?
I would write my own implementation in such case.
Calculation the SD is very straightforward.

On the same page on www.php.net you can also find a contribution with a
working example.

[Source]
http://nl2.php.net/manual/en/function.stats-standard-deviation.php

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;
}

Regards,
Erwin Moller

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация