(no subject)
Jan. 16th, 2008 02:23 pmDear Lazyweb,
I dropped out of AP Statistics and skipped Computer Science in high school. How do I make MySQL do quartiles, or medians, or something else equivalent?
I have several sets of numbers. I'd like to convert them to rankings with a range of 100, but shifted down so that the lowest numbers in each set have negative rankings. I have been doing it this way:
(number - quartile1)*(100/(max-min))
The problem is, I need to do this with MySQL, which has neither a quartile function nor a median function. I considered doing it this way instead:
(number-min)*(100/(max-min))-25
But the number of negative records is anywhere from 8% to 80%, too inconsistent for my purposes. Ideally I'd like to combine the two, so the rankings are offset by whichever formula results in a lower number of negative values.
Anyone know how to do this, or something better, in MySQL?
I dropped out of AP Statistics and skipped Computer Science in high school. How do I make MySQL do quartiles, or medians, or something else equivalent?
I have several sets of numbers. I'd like to convert them to rankings with a range of 100, but shifted down so that the lowest numbers in each set have negative rankings. I have been doing it this way:
(number - quartile1)*(100/(max-min))
The problem is, I need to do this with MySQL, which has neither a quartile function nor a median function. I considered doing it this way instead:
(number-min)*(100/(max-min))-25
But the number of negative records is anywhere from 8% to 80%, too inconsistent for my purposes. Ideally I'd like to combine the two, so the rankings are offset by whichever formula results in a lower number of negative values.
Anyone know how to do this, or something better, in MySQL?