Need help finding weighted percentages

Discussion in 'General Discussion' started by seph ir oth, Oct 10, 2016.

  1. seph ir oth

    seph ir oth Mod'n Dat News Jon Staff Member

    Ratings:
    +261 / 2 / -0
    Hello,

    Please see the following figures in the imgur link below:

    http://imgur.com/txqDONS

    So the situation: I am given anywhere from 1 to X numbers between -0.5 and 0.5. I need to give them weighted percentages based off of how close they are to 0.

    I think it should look something like:

    (1/X) * weight

    And the weight is something like:

    1 - abs(difference between red-line value and 0) / 0.5

    But that's not quite correct ... Figure 2, the 2 red lines close to the center will have too great a % ... I want all the red line's % to add up to 100% ...

    Any ideas?
     
  2. jonas

    jonas Well-Known Member

    Ratings:
    +42 / 4 / -0
    Normalize the distance...

    Code:
    distance_i = | 1/X_i | 
    totalDistance = \sum_i distance_i
    normalizedDistance_i = distance_i / totalDistance
    
    Clearly the sum of all normalized distances is 1:
    Code:
     
    \sum_i normalizedDistance_i = \sum_i distance_i / totalDistance 
      = (\sum_i distance_i) / totalDistance 
      = totalDistance / totalDistance 
      = 1
    
     

Share This Page