note 93199 deleted from function.stats-standard-deviation by danbrown

From: Date: Fri, 28 Aug 2009 00:14:25 +0000
Subject: note 93199 deleted from function.stats-standard-deviation by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159962@lists.php.net to get a copy of this message
Note Submitter: Mike Feldman ---- The above deviation formula is incorrect. Here's a fixed version. function deviation ($array){ $avg = average($array); $variance=0; foreach ($array as $value) { $variance+=pow($value-$avg, 2); } $deviation = sqrt($variance/(count($array)-1)); return $deviation; }

« previous php.notes (#159962) next »