Ranking of value based on given quartiles of a range

188 Views Asked by At

May be a noob question here, but my query is:

I have a range of values of which I have quantile values: example: q = [-10, 0.25, 0.5, 0.75, 10]

I have a score value say .85 which i wish to rank but the ranking should be influenced by the quantiles as well.

I tried min max scaling, but obviously it was not influenced by the mid range values.

My second approach was piecewise approach:

initialize empty range

  • for each quantile
    • calculate min and max, calculate range, divide by 25 to get step
    • build an array with the new step, min and max
    • add current array to main range.
  • for the derived range, figure out at which percentile does the input value exist.

i know this may be a bit coding related as well so please forgive in advance.

Basically i need is a rising value of ranking as below in image.

x axis: values in the original range

y axis: ranking percentile.

weighted rise in ranking

1

There are 1 best solutions below

2
On BEST ANSWER

This is how I interpret your problem: You have a list of increasing values: $$ \{ x_i \} = \{x_0, x_1, x_2, \ldots, x_n \}\qquad \text{with} \qquad x_n \leq x_{n+1} $$ and another list which just counts "how far we are in the list before the $i$th entry" in percentages, $$ \{ y_n \} = \left\{ \frac{0}{n}\cdot 100~\% ,\quad \frac{1}{n}\cdot 100~\% , \quad \frac{2}{n}\cdot 100~\%, \quad \ldots ,\quad \frac{n-1}{n}\cdot 100~\%, \quad 100\% \right\} $$ and the only task is to do linear interpolation between the points $(x_i, y_i)$ ($i=0,1,2,\ldots, n$). This is really easy because we know the values for these points for every index $i$. Wikipedia has a pretty clear article about this: https://en.wikipedia.org/wiki/Linear_interpolation#Linear_interpolation_between_two_known_points

In our case, the difference between the different values of $y$ is a constant $\frac{100~\%}{n-1}$ so the expressions simplify a little bit.
So basically what you want to do is to define a function like this: $$ f(x) = \begin{cases} y_0 + \frac{100~\%}{n-1}\frac{1}{x_1-x_0} (x-x_0), \qquad x\leq x_1 \\ y_1 + \frac{100~\%}{n-1}\frac{1}{x_2-x_1} (x-x_1), \qquad x_1 < x\leq x_2 \\ y_2 + \frac{100~\%}{n-1}\frac{1}{x_3-x_2} (x-x_2), \qquad x_2 < x\leq x_3 \\ \vdots \\ y_{n-1} + \frac{100~\%}{n-1}\frac{1}{x_n-x_{n-1}} (x-x_{n-1}), \qquad x_{n-1} < x\leq x_n \\ \end{cases} $$ Does this help you?