I have pairs of values e.g.

$A_{1} = -10$ , $B_{1} = 4$

$A_{2} = 6$ , $B_{2} = 4$

$A_{3} = 80$ , $B_{3} = 79$

I want to create a probability, $P(A) + P(B) = 1$ , such that the smaller values of A or B have higher probability. For example:

$P(A_{1}) = 0.8$ , $P(B_{1}) = 0.2$

$P(A_{2}) = 0.35$ , $P(B_{2}) = 0.65$

$P(A_{3}) = 0.47$ , $P(B_{3}) = 0.53$

I have broken my head trying to generate this type of proability but I haven't been able. I thought something like:

$P(A_{1}) = \frac{|A|}{|A+B|}$

But I am afraid this doesn't yield the expected results, specially when there are negative and positive values like in $A_{1}$ and $B_{1}$.

I would appreciate some suggestion on how I can generate such probabilities.

  • $\begingroup$ When you write "e.g." and then "For example:" is there a hidden functional relation betweeen the two sets of values ? Or are these two sets not linked at all ? $\endgroup$ – keepAlive May 3 '17 at 10:19
  • $\begingroup$ @Tnerual there is no relation at all. I made up the probabilities as an illustrative example. The point of the question is in fact what you mention, creating a link between the values and the probabilities such that smaller values of A or B have higher probability. $\endgroup$ – adrian1121 May 3 '17 at 10:22
  • $\begingroup$ I am curious to know what you think of my answer since it does yield the expected results ? $\endgroup$ – keepAlive May 3 '17 at 16:27

There are many choices, but here's an approach that will let you design many solutions easily. Break this task into two steps.

One scheme is to take some transformation $t$ of the values and then scale to $1$: $P(A) = \frac{t(A)}{t(A)+t(B)}$.

Note that $t$ should be positive and decreasing; this will make sure that smaller values get higher probability and that probabilities remain between $0$ and $1$.

For example either of $t(x) = \exp(a+bx)/(1+\exp(a+bx))$, or $t(x)=a+b.\exp(-cx)$
would all work when all the parameters ($a,b,c$) are positive. Any continuous monotonic decreasing survivor function on the real line would work ($t(x)=1-F(x)$ for any cdf $F$), as would $\log(1/F(x))$. Any number of other such functions might be used.

So consider $t(x) = \log(1/\Phi(\frac{x}{5}))$ (where $\Phi$ is the standard normal cdf). (A variation on one of the functions I mentioned before.)

Then for $A=-10$, $B=4$ we would have $P(A) = \frac{\log(1/\Phi(\frac{-10}{5}))}{\log(1/\Phi(\frac{-10}{5}))+\log(1/\Phi(\frac{4}{5}))} = \frac{3.783}{ 3.783+0.2381}=0.941$ (and $P(B)=0.059$).

  • $\begingroup$ Thank you for your answer. I see your point! However, I am afraid this trannsformation is not what I am looking for: In the last line of your answer you derive $P(A) = 0.3125$. But notice that I want to assign higher probability to the smaller value (A), so intuitively $A$ should yield higher probability than $B$'s. Thank you $\endgroup$ – adrian1121 May 3 '17 at 13:03
  • 1
    $\begingroup$ 1. You cannot write a function that returns a probability from inputs that are not probabilities without some form of transformation of those values. Your own function $\frac{|A|}{|A+B|}$ involves transformation as does the other answer here. But the point of my answer is to try to illustrate approaches to tailoring a solution that will do exactly what you want. $\:$ 2. Sorry, I was thrown off by your example function with absolute values and thought you intended "closer to 0" by "smaller". I've fixed that issue now $\endgroup$ – Glen_b -Reinstate Monica May 3 '17 at 17:05
  • $\begingroup$ Thank you very much for your answer. This is a clever and straightforward approach which allows for some freedom when modeling the transformation. Upvote and accept! Thanks. $\endgroup$ – adrian1121 May 4 '17 at 8:36

What about using a monotonic transformation which maps elements from $\mathbb{R}$ to $\mathbb{R}_{>0}$: like a power transformation, doing it in the base you want (I mean instead of using the constant $e ≈ 2.71828...$):

If one has

$A_{1} = -10$ , $B_{1} = 4$

$A_{2} = 6$ , $B_{2} = 4$

$A_{3} = 80$ , $B_{3} = 79$

and one uses the following base, say $e'= 0.905723664263907$ (lower than $1$ to make the function be monotonic decreasing on $\mathbb{R}$), one gets

$e'^{A_{1}}=2.6918003852647$, $e'^{B_1}=0.672950096316179$

$e'^{A_{2}}=0.552044756836908$, $e'^{B_2}=0.672950096316179$

$e'^{A_{3}}=0.000362791574496337$, $e'^{B_3}=0.000400554373050618$

finally one gets the following weights

$\frac{e'^{A_{1}}}{e'^{A_{1}}+e'^{B_{1}}} = 0.8$

$\frac{e'^{A_{2}}}{e'^{A_{2}}+e'^{B_{2}}} = 0.450650675$

$\frac{e'^{A_{3}}}{e'^{A_{3}}+e'^{B_{3}}} = 0.475264951$

As can be seen above, I chose $e'$ so as to get $0.8$ for the weight of $A_1$. But as you surely know, it could have been chosen relatively to the desired weight associated to $A_2$, $A_3$, none of those, any optimization/equalization criterion or simply setting $e'=\exp(-1)$.

  • $\begingroup$ Thank you very much for your answer! Your idea is smart and straightforward! Upvote! It worked perfectly! However, I accept the answer from @Glen_b as his approach allows more freedom and control over the transformation. Thanks again though. Adrian. $\endgroup$ – adrian1121 May 4 '17 at 8:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.