note 118473 added to function.stats-kurtosis

From: Date: Sat, 12 Dec 2015 09:35:59 +0000
Subject: note 118473 added to function.stats-kurtosis
Groups: php.notes 
Request: Send a blank email to php-notes+get-204332@lists.php.net to get a copy of this message
// If you don't have the php_stats library, you can use this function: public static function getKurtosis( $values ) { $numValues = count( $values ); if ( $numValues == 0 ) { return 0.0; } // Use function from php_stats library if available if ( function_exists( 'stats_kurtosis' ) ) { return stats_kurtosis( $values ); } $mean = array_sum( $values ) / floatval( $numValues ); $add2 = 0.0; $add4 = 0.0; foreach ( $values as $value ) { if ( ! is_numeric( $value ) ) { return false; } $dif = $value - $mean; $dif2 = $dif * $dif; $add2 += $dif2; $add4 += ( $dif2 * $dif2 ); } // foreach values $variance = $add2 / floatval( $numValues ); return ( $add4 * $numValues ) / ( $add2 * $add2 ) - 3.0; } ---- Server IP: 72.52.91.14 Probable Submitter: 85.251.188.122 ---- Manual Page -- http://php.net/manual/en/function.stats-kurtosis.php Edit -- https://master.php.net/note/edit/118473 Del: integrated -- https://master.php.net/note/delete/118473/integrated Del: useless -- https://master.php.net/note/delete/118473/useless Del: bad code -- https://master.php.net/note/delete/118473/bad+code Del: spam -- https://master.php.net/note/delete/118473/spam Del: non-english -- https://master.php.net/note/delete/118473/non-english Del: in docs -- https://master.php.net/note/delete/118473/in+docs Del: other reasons-- https://master.php.net/note/delete/118473 Reject -- https://master.php.net/note/reject/118473 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204332) next »