I have set of negative numbers

e.g. [-0.189, -3.55, -19.90, -0.0001]

now I have to convert this set to percentage such that largest number will have highest percentage.

e.g. in above example, -0.0001 should have highest percentage compare to -19.90

Currently I do following,

  1. Convert every number to positive by taking absolute value
  2. Convert positive number to their respective percentage (x*100/sum)
  3. 100-above percentage
  4. Convert again this to percentage (x'*100/sum)

However this approach is not keeping relative weight age of original numbers. Any ideas? I checked this similar question but I am dealing with negative numbers so can't really use that formula.

  • $\begingroup$ How are you going to use these percentages? Are you sure you want $-.0001$ to have a higher percentage than $-19.90?$ If you are wanting the percentage each contributes to the sum, $-19.90$ is contributing much more than $-.0001$ and the usual formula of $x\cdot 100/sum$ works well. $\endgroup$ – Ross Millikan Aug 31 '17 at 16:14
  • $\begingroup$ If you want, you can just add some number to all of them to make them positive and use the usual formula again. The problem with this is how you choose that number. In your example, if you use $20$ then $-19.90$ will come out almost $0\%$. If you use $1,000,000$ they will all come out the same. $\endgroup$ – Ross Millikan Aug 31 '17 at 16:16
  • $\begingroup$ -19.90 should have lowest percentage. I just thought of doing something like 1/abs(x) and then taking percentage. Is that sounds logical ? $\endgroup$ – Dexter Aug 31 '17 at 16:16
  • $\begingroup$ I think adding a constant sounds more logical, but without knowing the purpose I don't know. $\endgroup$ – Ross Millikan Aug 31 '17 at 16:18
  • $\begingroup$ @RossMillikan, thanks. I actually want to pick number from given set with unequal probability and larger the number, higher the probability. $\endgroup$ – Dexter Aug 31 '17 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.