Re: [PHP] 95th percentile of an array.

2011-01-30 Thread Adam Richardson
On Sun, Jan 30, 2011 at 10:39 PM, Adam Richardson wrote: > On Sun, Jan 30, 2011 at 8:44 PM, Marc Trudel wrote: > >> Just out of curiosity, wouldnt it be better to use floor($n) instead of >> round($n-0.5)? >> > > Hi Marc, > > I don't think so, although I could have missed something (I just quick

Re: [PHP] 95th percentile of an array.

2011-01-30 Thread Adam Richardson
On Sun, Jan 30, 2011 at 8:44 PM, Marc Trudel wrote: > Just out of curiosity, wouldnt it be better to use floor($n) instead of > round($n-0.5)? > Hi Marc, I don't think so, although I could have missed something (I just quick cranked out the example.) The definition I linked to involves roundin

Re: [PHP] 95th percentile of an array.

2011-01-30 Thread Marc Trudel
Just out of curiosity, wouldnt it be better to use floor($n) instead of round($n-0.5)? On Sun, Jan 30, 2011 at 5:48 AM, Paul Halliday wrote: > On Sat, Jan 29, 2011 at 2:28 PM, Adam Richardson > wrote: > > For the nearest rank computation, you could use the following: > > > > $arr = > > > array(1

Re: [PHP] 95th percentile of an array.

2011-01-29 Thread Paul Halliday
On Sat, Jan 29, 2011 at 2:28 PM, Adam Richardson 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) -

Re: [PHP] 95th percentile of an array.

2011-01-29 Thread Adam Richardson
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, t