Re: 95th percentile of an array.
| From: | Paul Halliday | Date: | Sat, 29 Jan 2011 20:48:02 +0000 |
| Subject: | Re: 95th percentile of an array. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311081@lists.php.net to get a copy of this message | ||
On Sat, Jan 29, 2011 at 2:28 PM, Adam Richardson <simpleshot@gmail.com> wrote:
> For the nearest rank computation, you could use the following:
>
> $arr =
> array(12,89,65,23,90,99,9,15,56,67,3,52,78,12,10,88,77,77,77,77,77,77,77);
> sort($arr);
> $score_representing_95th_percentile = $arr[round((95/100) * count($arr) -
> .5)];
> echo $score_representing_95th_percentile; // 90
>
Perfect, exactly what I was looking for.
thank you.