# Quantify a single value within a population

If I have a collection of student scores, what is a good way to create a 'single vs. group' statistic? What I would like to know is how the single score compares to the group of scores against which it is juxtaposed.

So, for example: lets say that the test permits values from 1 to 9 (inclusive), and we are looking at a score of 3. We could say that 3 is around 33% - but this doesn't factor in the other scores: what if 3 was the lowest score of the group? What if it was the highest?

Even just a one-word answer pointing me in the right direction of some research I could do would be appreciated. Obviously even better if you can help me understand :-).

You can use the empirical cumulative distribution function $ecdf$, which tells you what fraction of all scores are equal to or below some score.

Say your scores are $\{1, 1, 1, 1, 3, 3, 3, 4, 5, 5, 5, 6, 6, 6, 8, 8, 9, 9, 9, 9\}$. Then $ecdf(3)=0.35$, meaning that student is in the top 65% of the class, there are 35% equal or below.

In R you can do it like this:

a <- c(8, 6, 9, 8, 3, 5, 5, 9, 1, 6, 3, 1, 9, 5, 3, 1, 1, 4, 9, 6) # sample data
f <- ecdf(a) # compute the ecdf
f(3) # how many at or below 3?
 0.35 # 35%
f(a) # check all students
 0.80 0.70 1.00 0.80 0.35 0.55 0.55 1.00 0.20 0.70 0.35 0.20 1.00 0.55 0.35 0.20 0.20 0.40 1.00 0.70

• Thanks for your answer Julián, I will read further on it. An additional question though - if we were looking at ecd f(3) as you proposed, I can see that 35% of the sample obtained 3 or below. But could you say that a score of 3 is in the 'top' 65%? Intuition tells me that a score of 3 is in fact the top 80% (16 scores of 3+ out of 20 = 0.8). Is my logic flawed here? Just trying to understand the relationship between the 'top' and 'bottom' percentages. Thanks Jun 24, 2013 at 1:47
• Yes, it all depends on how you deal with ties. As ecdf gives you "less than or equal" it is always safe to say "bottom X%". Jun 24, 2013 at 1:52