[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

percentile calculation

Posted on 2004-04-23
5
Medium Priority
?
2,387 Views
Last Modified: 2013-12-24
Anyone know of an easy way (any way) to calculate percentiles in ColdFusion?

I've a plethora of stats ... from members with easy reach via a MySQL database tables.
I'm looking to perform percentile calculations and cannot see a built-in function in CF or MySQL.

Any ideas!?

for example; ...
I can determine the income level of each and every one of my members.
I'd like to tell a SPECIFIC member which income percentile he fits ... in his specific region of the country (and/or world.

Thanks!
I'm a total CF newbie ... but slowly but surely these tidbits help!
Richard
www.opinion-exchange.com
0
Comment
Question by:rcbuchanan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 10904863
Well you could use basic math functions,

* / + - < > =
with statements like

<cfswitch>
<cfcase>
<cfif>
<cfscript>

What's an example of what you want to do?
maybe a basic function to post, something that you want to do so you can get a better idea of how to do it?
0
 

Author Comment

by:rcbuchanan
ID: 10904918
ok,
i'll try and describe:

I have a member table with a field called something like 'income' with a $ value.
i.e. member earns $123(k).

I have ... say ... 5,800 members.

I need to tell user # 123 that his income of $123k is in the 97th percentile (for example) of members.

OBVIOUSLY I'd use SQL statement to build a decent / focused selection of credible users ...
BUT ok, math not being my strong point (chased the girls, ignored the classes) ... how do I use CF to calculate!?

Thanks
R
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10905042
Hi rcbuchanan,

You first need to build a list and work out the persons position in the list.

<cfquery name="getList">
    select *
    from member
    order by income
</cfquery>

<cfoutput query="getList">
    <cfif Name eq = "Person Searching">
    <cfset Position = currentRow />
    <cfbreak />
</cfoutput>

<cfset percent = (1 - (Position / getList.RecordCount)) * 100 />

So if they were 5 of one hundred people they are in the 95th precentile.

This is based on order of merrit, not based on salary.

Regards
Plucka
0
 
LVL 18

Accepted Solution

by:
Plucka earned 2000 total points
ID: 10905061
rcbuchanan,

oops

<cfset percent = (1 - (Position / getList.RecordCount)) * 100 />

should be

<cfset percent = Position / getList.RecordCount * 100 />

cause i did asc order on the query, so they would appear as say 95/100 being the 95th percentile.

Regards
Plucka
0
 

Expert Comment

by:ErwinMoller
ID: 12663602
Yes, all fine, but how to handle a series of the same numbers?

Consider the following list:

1,2,5,9,12,12,12,12,12,15,21,25

If I score a 12, what is my percentile?
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question