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

That said, there are many ways to calculate percentile (I tend to think in
Z-scores, myself), and nearest rank has its issues, depending on your needs:
http://en.wikipedia.org/wiki/Percentile

<http://en.wikipedia.org/wiki/Percentile>Hopefully the example and the link
give you enough to get what you need working.

Adam

On Sat, Jan 29, 2011 at 11:15 AM, Paul Halliday <paul.halli...@gmail.com>wrote:

> What is the quickest way to do this? Will stats_stat_percentile work?
> If so, does anyone have examples of its operation?
>
> Keep in mind that my math is terrible. Use small words :)
>
> Thanks.
>
> --
> Paul Halliday
> http://www.pintumbler.org
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

Reply via email to