How to apply a percent increase to a single element in a probability set, with a percent decrease to other elements

percentagesprobability

Similar to my last question, I'm trying to figure out how to do something for the game SCP: Secret Laboratory.

There are four victory types in the game:

  • Facility Forces (MTF) Win
  • Chaos Insurgency Win
  • Anomalies Win
  • Draw

A diagram for the victory conditions can be found here.

The final two branches are exclusive (SCPs are alive or not alive), so there are three possibilities:

First and Second Branch

  1. Facility Forces – 20%
  2. Stalemate – 40%
  3. Anomalies – 20%
  4. Chaos Insurgency – 20%

Second and Third Branch

  1. Stalemate – 40%
  2. Anomalies – 20%
  3. Insurgency – 40%

First and Second Branch

  1. Foundation – 25%
  2. Stalemate – 50%
  3. Insurgency – 25%

I don't know how to use set notation formatting (I tried) but this essentially leaves me with three sets:

{20, 40, 20, 20} = 100
{40, 20, 40} = 100
{25, 50, 25} = 100

What I want to do is apply a percent increase to one element of the set while scaling the other elements of the set down at the same rate.

For instance, if 80% of remaining players are Facility Forces, with 10% Anomalies and 10% Chaos Insurgency, I want to scale the first set so that the probabilities more accurately reflect this:

20 * 1.8 = 36 = {36, 40 * ?, 20 * ?, 20 * ?} = 100

Here are all the algorithms I've tried so far. You can tell why I'm a programmer and not a mathematician.

  1. MTF probability times (1 + (mtfAlive / totalAlive)), Chaos Insurgency times (1 - (mtfAlive / totalAlive)), etc. without changing draw percentage, probability goes over 1.
  2. Times draw probability by (1 - (totalAlive - (aliveMTF + aliveCI + aliveSCPs)) / totalAlive).
  3. Get the MTF probability buff (1 + (aliveMTF / totalAlive)) and then calculate the debuff by multiplying the other values by (1 - (aliveMTF / totalAlive)) / 3.
  4. Same as above but I used subtraction for the second step
  5. Get the percent change in MTF probability mtfProbability * 1 + (aliveMTF / totalAlive) - mtfProbability and then divide that change by 3. Add the buff to MTF probability and subract the divided buff from all other probabilities (this worked, but some percentages were negative).

Does anyone know how I can increase one value by a certain rate and then decrease the other values in the set by the same rate?

Visually, I imagine it working like a slider except moving one position on the slider moves the other positions.

Best Answer

Mathematically, you initially have an ordered list of nonnegative numbers $(a,b,c,d)$ with $a+b+c+d=1$ and you want to change these numbers to $(A,B,C,D)$ such that $A+B+C+D=1$, $r=A/a$ and the relative ratios of $(B,C,D)$ are the same as the relative ratios of $(b,c,d)$, where $r$ is known.

The second condition means that $\frac{b}{b+c+d}=\frac{B}{B+C+D}$, $\frac{c}{b+c+d}=\frac{C}{B+C+D}$ and $\frac{d}{b+c+d}=\frac{D}{B+C+D}$.

We have $A=ra$, $B=b \frac{B+C+D}{b+c+d} = b \frac{1-A}{1-a} = \frac{1-ra}{1-a}b$ and similar formulas for $C$ and $D$. Therefore,

$$ (A,B,C,D) = (ra, \frac{1-ra}{1-a}b, \frac{1-ra}{1-a}c, \frac{1-ra}{1-a}d) $$

Example: If $(a,b,c,d)=(20\%,40\%,20\%,20\%)$ and $a$ is increased by $80\%$, we have $r=1.8$ so $A=36\%$, $\frac{1-ra}{1-a}=\frac{9}{10}$, hence $B=36\%$, $C=18\%$ and $D=18\%$ (Note that $c=d$ and $b=2c$, so $C=D$ and $B=2C$).

Related Question