Re: Finding Mode

From: Date: Sun, 08 Dec 2002 19:31:01 +0000
Subject: Re: Finding Mode
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127442@lists.php.net to get a copy of this message
On Sat, Dec 07, 2002 at 07:12:09PM -0500, Stephen wrote: > > Another math question... How would I find the mode (number that repeats most > often) of an array? Then, if there isn't a number that repeats most often, > tell the user that. A while back, I wrote functions for mean, median and mode. I've put them up at http://www.it.ca/software/statsmmm.php . I don't much like the mode function -- it seems awkward, but I couldn't figure out how to write it any smaller. Also included is a function that calculates the 95th percentile of values in an array, roughly the same way the median() function works ... but I don't recommend using this for bandwidth calculations for co-lo customers because of the hassle of pulling all that data into an array. 95th percentile is more easily calculated in the SQL server than in php. -- Paul Chvostek <paul@it.ca> Operations / Abuse / Whatever +1 416 598-0000 it.canada - hosting and development http://www.it.ca/

« previous php.general (#127442) next »