MySQL Forums
Forum List  »  Newbie

Re: Calculation of a '95th percentile'
Posted by: laptop alias
Date: August 03, 2010 05:43AM

Regardless of what the help file says, perhaps the formula that Excel 2003 uses is in several stages, as follows:

First calculate x=(n+1)*k where n is the total number of values and k is the target percentile.

The resulting figure will contain an integer component and a decimal component (j.g), where j + g = x

Next find the value in your list ranked j and (depending on whether g is larger or smaller) the value immediately above it or the value immediately below it.

Finally, do this

j_smaller+((1-g)*(j_larger-j_smaller)

So, to take the example of the 90th and 95th percentiles from your dataset:

Example 1

k=0.90
n=50

x = (50+1)*0.90 = 45.9

So j_smaller = 45 corresponding to 22400
j_larger = 46 corresponding to 23995
g = 0.9

And 22400+((1-0.9)*(23995-22400)) = 22559.5

Example 2

k=0.95
n=50

x = (50)*0.95 = 48.45

So j_smaller = 47 corresponding to 27787
j_larger = 48 corresponding to 27889
g = 0.45

And 27787+((1-0.45)*(27889-27787)) = 27843.1

Now, I'm not sure that that's right, nor how the hell to write that up as MySQL!?!?

Options: ReplyQuote


Subject
Written By
Posted
Re: Calculation of a '95th percentile'
August 03, 2010 05:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.