473,581 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# percentile rank algorithm

Has anyone written a percentile rank algorithm that they can share or
know of a good resource that defines the algorithm. I'm starting a
project that involves percentile ranks, logistic and linear regression.
If not c# any language or pseudo code would be very useful. Thank you.


Sent via .NET Newsgroups
Nov 30 '05 #1
1 14294
Joe wrote:
Has anyone written a percentile rank algorithm that they can share or
know of a good resource that defines the algorithm. I'm starting a
project that involves percentile ranks, logistic and linear regression.
If not c# any language or pseudo code would be very useful. Thank you.


Sent via .NET Newsgroups

Forgive me if I'm wrong but isn't percentile rank just counting how many
of the values are below or equal the specific value you're looking at in
terms of percentage of the entire list of values ?

Ie. if you have a value of 50, and there are 75 values in the list, and
30 of those are 50 or below, wouldn't this mean that the percentile rank
of 50 in this list is (30/75)*100 = 40%?

I'd assume sorting the list, then running through it and assigning
percentile ranks would be the best way. You'd have to handle duplicate
values though:

1, 1, 2, 2, 3, 3, 4

would have percentile ranks of:

25%, 25%, 50%, 50%, 75%, 75%, 100%

(if I'm not wrong about what a percentile rank is)

pseudo-code for the above:

- sort list
- loop through all elements from start to finish (lowest to highest)
- find all duplicates of the value you're looking at
- calculate percentile rank as number of values below the value
(index of the loop), plus the number of duplicates, divided by
the number of elements in the list
- skip past duplicates

Lasse Vågsæther Karlsen
mailto:la***@vk arlsen.no
PGP KeyID: 0x2A42A1C2
Nov 30 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: adrianTNT | last post by:
Hello; Anyone knows how can I create a scrip that returns the google page rank of a given web page? I have seen this on many web pages but I want to host my own script and I dont know how it is made. I want it to be something like this: http://www.googlecommunity.com/scripts/pagerank.php?url=www.adriantnt.com
by: jd142 | last post by:
Normally when people ask about getting the Nth percentile from a group, the response is to write a couple of VBA modules. But it seems to me there's a simpler way that just uses 2 queries. You might even be able to get it down to one query if you nest them. Here's how I get the 25th percentile number from a table, where mynumber is the...
by: dam_fool_2003 | last post by:
Just now I asked a question about signed char and unsigned char. I had the replay very fast by jens.torring and Tim prince. I post via google so now goes my thanking replay. (I must be more precise according to jens.torring's replay) As I was reading the slandered draft C99 about the conversion (6.3) I have interpreted the word conversion...
by: Dave Veeneman | last post by:
I'm looking from an algorithm that will do a statistics calculation for me-- it's the first time 'Numerical Recipies in C' has failed me! A normal distribution table tells me the probability (by percentile) of an item, given something called a z-score. If I have a z-score, I can look up the probability in a distribution table. There are...
by: Steve Edwards | last post by:
Hi, Given a map: typedef map<long, string, greater<long> > mapOfFreq; Is there a quicker way to find the rank (i.e. index) of the elememt that has the long value of x? At the moment I'm iterating through the map and keeping count of when I hit it.
by: orenlevy1 | last post by:
Hi Everyone. I have a problem that I could not figure out what to do with it. I have a couple of tables and views. All have the same unique ID. When a user try to do a search on our web site we want to try to look in multiple tables and views, Rank the results and aggregate the results back (remove any duplicates). Part of the search is...
by: riaane | last post by:
Hey clever people, Excel has the =PERCENTILE function. This calulates a percentile value from an array of values. Is there any equivalent in Access?
by: artemetis | last post by:
Hello! It's me again. tblEmp -->empUid - self explanatory -->empPerf - ranking from 0 - 100 I'm interested in creating a query that displays the top x% (eg, 20%) of employee performance, based on empPerf. Qry operator will be prompted for value of X%. I'm not too familiar with stats, but searched through the site and found l was only...
by: SachinPatel | last post by:
ADezii, i have been reading your solution to this percentile problem and believe you can help me. I have a similar problem with creating a percentile in access 2007. My table is called "TBL_DATA" and the field with all the values i would like to gain a percentile for is called "DAYS" i want to develop a query which shows the following...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.