PDA

View Full Version : Looking for math on advantage/disadvantage



Elric VIII
2017-11-16, 04:03 PM
It's been a while since I've delved into the statistics world and I cannot seem to find what I need on google as most of the sources are not online anymore. I'm looking for an equation to model the values in this table (http://onlinedungeonmaster.com/wp-content/uploads/2012/05/Advantage_Disadvantage_Probabilities.png) which gives me the probability of hitting a given AC when I need a target number or greater on a d20. The numbers here come up fairly often, so I assume they are accurate. I've tried to use some regression calculators online but I cannot seem to find an equation that can accurately model this distribution. Can someone point me in the right direction?

Nifft
2017-11-16, 04:09 PM
Regular: 1d20 >= N

Advantage: max(1d20,1d20) >= N

Disadvantage: min(1d20,1d20) >= N


If you're looking for statistics, check for graphs of two independent variables, which I'm going to call X & Y below. The target number is N.

Advantage is where (X >= N) or (Y >= N).

Disadvantage is where (X >= N) and (Y >= N).

Knaight
2017-11-16, 04:12 PM
The equations are pretty simple probability math. Basically, think of it this way:

Normal: You need to hit once. This is what generates the basic probability values used in later calculations. Let p be the chance of hitting, and q be a miss (q=1-p) for the normal case.

Disadvantage: You need to hit twice. Using P as the specific probability under disadvantage: P=p^2

Advantage: You need to not miss twice. Using P as the specific probability under advantage: P=1-q^2

Rysto
2017-11-16, 04:17 PM
For advantage, It's easiest to approach the problem from the other angle. Your chance of rolling X or better on one of two dice is the inverse of your chances of rolling both dice < X. There are X - 1 ways or rolling less than X, so your chances of rolling < X on both are (X-1/20)**2. Therefore your chances of rolling X or better with advantage are 1 - (X-1/20)**2

For disadvantage, you can look at the problem straight-up. Your chance of rolling X or better on one die is (21 - X)/20. On two dice, it's ((21-X)/20)**2.

Elric VIII
2017-11-16, 04:17 PM
Regular: 1d20 >= N

Advantage: max(1d20,1d20) >= N

Disadvantage: min(1d20,1d20) >= N


If you're looking for statistics, check for graphs of two independent variables, which I'm going to call X & Y below. The target number is N.

Advantage is where (X >= N) or (Y >= N).

Disadvantage is where (X >= N) and (Y >= N).

Maybe I'm not understanding, but there should be some sort of discreet equation to predict your chance of success. For example, using 1 die:
X = target number
Y = chance to roll target number or higher
N = number of sides on the die


Y = [N+1-X]/N

So for a d20 needing to roll a 6 or higher you have a [20+1-6]/20 = 0.75 = 75% chance of rolling a 6 or higher. How can I modify that equation for rolling 2 dice and taking the best or worst of the roll?


The equations are pretty simple probability math. Basically, think of it this way:

Normal: You need to hit once. This is what generates the basic probability values used in later calculations. Let p be the chance of hitting, and q be a miss (q=1-p) for the normal case.

Disadvantage: You need to hit twice. Using P as the specific probability under disadvantage: P=p^2

Advantage: You need to not miss twice. Using P as the specific probability under advantage: P=1-q^2

Oh, that's what I needed. Thank you.

HermanTheWize
2017-11-17, 08:39 AM
Maybe I'm not understanding, but there should be some sort of discreet equation to predict your chance of success. For example, using 1 die:
X = target number
Y = chance to roll target number or higher
N = number of sides on the die


Y = [N+1-X]/N

So for a d20 needing to roll a 6 or higher you have a [20+1-6]/20 = 0.75 = 75% chance of rolling a 6 or higher. How can I modify that equation for rolling 2 dice and taking the best or worst of the roll?

Here's your equation, using your variables. For Advantage.

Only Change I use P as my probability for a single dice and Y for two.

P = [N+1-X]/N

Y = [(P)^2 ] + 2P(1-P)



Advantage

Examples(20 sided dice):

Y(20) = (1/20)^2 + 2(1/20)(19/20) = .0975 => 9.75% chance of rolling a 20

Y(19) = (2/20)^2 + 2(2/20)(18/20) = .19 => 19% chance of rolling a 19 or higher

.
.
.
.

Y(2) = (19/20)^2 + 2(19/20)(1/20) = .95 => 99.75% chance of rolling a 2 or higher

Y(1) = (20/20)^2 + 2(20/20)(0/20) = 1 => 100% chance of rolling a 1 or higher










Disadvantage is much easier(again Y will be the probability you hit your target number or higher):

P = [N+1-X]/N

Y = [(P)^2 ]

Examples(20 sided dice):

Y(20) = (1/20)^2 = .0025 => .25% chance of rolling a 20

Y(19) = (2/20)^2 = .01 => 1% chance of rolling a 19 or higher

.
.
.
.

Y(2) = (19/20)^2 = .9025 => 90.25% chance of rolling a 2 or higher

Y(1) = (20/20)^2 = 1 => 100% chance of rolling a 1 or higher

robbie374
2017-11-17, 09:45 AM
Lots of great calculations here! Here is an easy way.

Variables:
21 = the number of sides on the d20 + 1 because a tie is a success.

For attacks:
AC of target
Att = your attack bonus

For saving throws:
DC of effect
ST = your saving throw bonus

Calculations vs. Percentages:
Multiplying by .05 is the same as 5%. To convert from a decimal to a percentage, multiply the number by 100. To convert from a percentage to a decimal, divide the number by 100.

Normal:
Chance of Attack Success (S) = (21 - AC + Att) * .05
Chance of Saving Throw Success (S) = (21 - DC + ST) * .05

Advantage:
Chance of Success (SA) = S * (2 - S)

Disadvantage:
Chance of Success (SD) = S * S


Chance of failure = 1 - Chance of success

Tanarii
2017-11-17, 10:43 AM
The generic probability function (P) for exactly k successes in n attempts with p chance of success in a binomial distribution is:

P = [n! / k! * (n-k)!] * p^k * (1-p)^(n-k)

With values of k=0 and n=2 (disadvantage chance of failing with advantage) this works out to:

P = (1-p)^2

With values k=1 + k=2 and n=2 (advantage, probability of both one success and both successful):

P = 2*p*(1-p) + p^2

If you notice, this is breaking out the two parts of a simple binomial function. Specifically, the function P(total) = [(1-p)+p]^2 = 1

p (lowercase) in this case is hit chance. Stick in other formulas in there involving AC and number on the die as you like.

Elric VIII
2017-11-17, 11:28 AM
Thank you very much everyone. I've got the info I need up and running.

Knaight
2017-11-17, 02:48 PM
With values k=1 + k=2 and n=2 (advantage, probability of both one success and both successful):

P = 2*p*(1-p) + p^2
Expanding this out (as an indirect way to reach the 1- (k=0) value:
1-(1-p)^2=1-(1-2p+p^2)
1-((1-p)^2)=2p-p^2

P = 2p(1-p)+p^2
P=2p-2(p^2)+p^2
P=2p-p^2

From this we can clearly see that 1-(1-p)^2 is equivalent to 2p(1-p)+p^2, and it's a much quicker form to use.

Tanarii
2017-11-17, 03:02 PM
From this we can clearly see that 1-(1-p)^2 is equivalent to 2p(1-p)+p^2, and it's a much quicker form to use.Agreed. That's usually the way I arrive at it. And it's even more important/quicker as n gets larger, and you're looking to determine 'any success'.

For example, if Elven Accuracy or Lucky is in play, n goes to 3. So P=1 - (1-p)^3

But the original equation becomes relevant again if you're looking at things like k or more ability scores of X or higher (with p chance to get an X or higher) among n=6 ability scores. Or even the chance of getting X or higher on 4d6b3.

Honestly, I just stick it all in anydice.com ;)

Edit: what I'm not sure how to do is disadvantage. Not even sure it'd use the same formula.

Knaight
2017-11-18, 05:36 AM
Honestly, I just stick it all in anydice.com ;)
Likewise.


Edit: what I'm not sure how to do is disadvantage. Not even sure it'd use the same formula.
Disadvantage is really easy - you need to succeed on all the rolls, so it just works out to squaring the initial probability.

Tanarii
2017-11-18, 10:20 AM
Disadvantage is really easy - you need to succeed on all the rolls, so it just works out to squaring the initial probability.
/facepalm. of course.

Okay so the fun one is Lucky with disadvantage done properly, ie not the SA way, vs done the SA way of rolling all three and picking the best one, ie turning disadvantage into super advantage. So roll two, take lowest, then roll one more and take highest, should be determine probability of disadvantage success first, then take multiply disadvantage failure by single roll failure and subtract from one.

Lucky done right:
pD = p^2
P = 1-(1-pD)*(1-p) = 1-(1-p^2)*(1-p)
P = p+p^2-p^3
Plot 0 to 1 (http://m.wolframalpha.com/input/?i=plot+p%2Bp%5E2-p%5E3+from+0+to+1)

Lucky done SA method:
P = 1-(1-p)^3
P = 3p-3p^2+p^3
Plot 0 to 1 (http://m.wolframalpha.com/input/?i=plot+3p-3p%5E2%2Bp%5E3+from+0+to+1)

Yup. As I thought immediately on reading that SA, those are two considerably different things. If you plot them, the first is close to a straight line, or lucky canceling out disadvantage. The latter is a super advantage curve.

I understand they wanted simplicity but JC must also know enough instinctive probability without crunching numbers to have had that be immediately obvious to him too. At least my id hope he does.

Edit: going back and looking at the SA I'm writing about, even his complex method is totally off base. It's lucky first, then disadvantage. /sigh

Edit2:
Okay the SA Lucky first then disadvantage is close to a straight line too. It's just much worse odds than disadvantage first.
P = (2p-p^2)]*p
Plot from 0 to 1 (http://m.wolframalpha.com/input/?i=plot+%282p-p%5E2%29%5D*p+from+0+to+1)

KorvinStarmast
2017-11-18, 03:50 PM
There are some nice figures here (https://rpg.stackexchange.com/q/14690/22566) that illustrate the math discussed above.

bid
2017-11-18, 04:37 PM
Disadvantage is really easy - you need to succeed on all the rolls, so it just works out to squaring the initial probability.
Yep, just like disadvantage fails when both fails, you square the failure.
It's only the (1 - p) to convert between success/failure that makes it look hard.

Knaight
2017-11-19, 02:02 AM
Yep, just like disadvantage fails when both fails, you square the failure.
It's only the (1 - p) to convert between success/failure that makes it look hard.

Advantage, and there's slightly more to it - it's 1-(1-p)2, not just (1-p)2. It's all really straightforward math, and it stays straightforward given more dice unless you start taking dice in the middle of the order.