Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Merle_Hanson #1
Percentile Function
I am trying to get a 90th percentile number out of a list of numbers.
Example... Number List = 1,2,3,4,5,6,7,8,9,10,11 and the 90th percent number
would be 10 Number List = 2,3,4,5,6,7,8,9,10,11,12 and the 90th percent number
would be 11 Number List = 4,5,5,6,6 and the 90th percent number would be 6 But
not sure how to do this... Excel has a function -> Percentile({1,2,3,4},0.3) =
1.9 <- this is 30th percent though... I can't seem to figure out how to get CF
to spit it out... Do I build a number list, and array or what... I am pulling
my hair out - any help is appreciated... Merle
Merle_Hanson Guest
-
#40509 [NEW]: key() function changed behaviour if global array is used within function
From: alex dot killing at gmx dot de Operating system: MaxOsX/RedHat PHP version: 5.2.1 PHP Bug Type: Arrays related Bug... -
[PHP-DEV] named function arguments (was: Proposal: Dangling comma in function
Christian Schneider wrote: Named parameters - i think is very good idea. I know i would use them. I'm really not sure about the correct... -
#25866 [Opn->Bgs]: Using error_reporting() function don't change output of phpinfo() function
ID: 25866 Updated by: sniper@php.net Reported By: sfournier at dmsolutions dot ca -Status: Open +Status: ... -
note 33714 added to function.register-tick-function
please can anyone help me to discover if this function can be used to make a chat ---- Manual Page --... -
note 33132 deleted from function.register-shutdown-function by sniper
Note Submitter: markus@malkusch.de ---- I can't agree with nick at nickjoyce dot com. I use php 4.2.3 on linux and my shutdown function is... -
jdeline #2
Re: Percentile Function
I'm assuming that the definition of the 90th percentile is that number in a
list that is greater than 90% of all numbers and less than 10% of all numbers.
If this is correct, then sort your list , count the number of elements in the
list, multiply the count by 0.9 and use the result in a ListGetAt statement.
See code below.
<CFSET stuff = "1,3,7,5,4,8,2,4,3,6,5,1,8,4">
<CFSET stuff = ListSort(stuff, "Numeric", "Asc")>
<CFSET count = ListLen(stuff)>
<CFSET i = Round(count * 0.9)>
<CFSET ninty = ListGetAt(stuff, i)>
jdeline Guest
-
Merle_Hanson #3
Re: Percentile Function
Close I think thanx... I'm trying different number lists... For example -
12.2,14,33.4,3.7,8,6.5,4.75 is a list of 7 numbers... And your code gets me the
number 14 as 90th %... When I do same code in excel - I get 21.76 as number...
So not sure how to get that 21.76 number...
Merle_Hanson Guest
-
jdeline #4
Re: Percentile Function
There appear to be more than one definition of percentile. Mine is one of them; you can get more information about this wierdness at [url]http://cnx.rice.edu/content/m10805/latest/[/url].
jdeline Guest
-
Merle_Hanson #5
Re: Percentile Function
yes - that is where i started...
I'm at a loss though... Part of me say ur solution is correct - but doing same numbers in Excel - relates there is a different number...
Merle_Hanson Guest



Reply With Quote

