Axes and Arithmetic 2: The Binomial Distribution

Started by Jubal, July 21, 2018, 10:21:50 PM

Previous topic - Next topic

Jubal

Axes and Arithmetic 2: The Binomial Distribution
By Jubal




If you roll snake eyes twice, a wild Binomial is summoned!. Photo: Tom Natt
What's a binomial and how do we fight it?

Last time, we looked at how to calculate the probability of an individual soldier with one attack doing a wound on an opponent, based on the chances of them hitting, wounding, and taking saves all combined. However, when your soldier has two attacks – let alone if you're dealing with whole regiments – the system breaks down. In this second article of Axes and Arithmetic, I'm about to show you how to simulate entire regiments of warriors fighting to the death – just using numbers!

Once again, we're using old-school Warhammer Fantasy Battles as our basic rules system for this article: for anyone unfamiliar, the close combat system involves usually up to three dice rolls: a "to hit" roll, a "to wound" roll, and an "armour save" where applicable. The die rolls required for each are found by comparing the stats of the units and consulting a chart in the rulebook (which you don't have, but I did when I wrote this so don't worry!). This gives us a basic set of probabilities that we can work with here.

So let's start with the following problem; I have a unit of 10 human swordsmen, fighting against five Dwarf Hammerers. Assuming the swordsmen attack first, what's the chance they'll do the five wounds needed to eliminate the enemy? The model to do this is called the Binomial distribution; you work with it via a formula that tells you the chances of managing to achieve a certain probability (say, a kill) a certain number of times with a certain number of "tests" (the number of attacks in this case).

The first thing we need is the probability of one attack killing; we call this the probability, or p. It's calculated just as we did in the last article - the soldier is on 4+ to hit, so 3/6 chance, 5+ to wound against the T4 dwarf, so 2/6 chance, and the dwarf has a 5+ save, so that's a 4/6 chance of him failing. 4x2x3 = 24 out of 6x6x6 = 216. We need that as a decimal, however - that's 0.11 (recurring, but I'm going to ignore the recurrence in the subsequent calculations). Then we need the number of attacks – in this case, eleven assuming I have a unit champion.


The Winning (or Losing) Formula

OK, now we've got our probability, let's get down to some calculations.

X (big X) is your variable.
x (little x) is the value you want it to take, in this case we want to know the probability of 5 successes so x=5
p is your probability, 0.11
q is 1 minus your probability, 0.89
n is the number of trials (in this case, that's our number of attacks)

P(X=x) = (n c x) times p^x times q^(n-x)

The ^ symbol is "to the power of", if you're unfamiliar with it. The "c" (or "combination) "function can be found as a second function (notated nCr) on most decent calculators.



Snorri over there took an axe to a hammer fight, which doesn't seem entirely fair... Photo: Craig McInnes

If you don't want to know what the c function does under the bonnet, you can skip this next bit: the combination function is properly defined as: n! / r! x (n - r)! where ! is a factorial (that is, multiply all the integers up to that number, so 3! is 1x2x3 = 6, 4! 1x2x3x4 = 24, etc. As you can see, this only works with discrete, positive integers - you can't have half a success in this system! What the combination function gives us is the number of possible combinations of size r available from a total set of items of size n, ignoring order. So "if I have ten different adventurers and need to choose a team of three, how many different options for my team do I have" can be answered by 10 c 3 = 120.

OK, now let's look at what this does with the numbers we had earlier.

P(X=5) = (11 c 5) times 0.11^5 times 0.89^6

= 462 times 0.000016105 times 0.496981291
(This stage should be done in one go, I'm just writing it out for explanation)

= 0.003697817

Ta-da!


Victory! ...right?

So now we have our result. But what does that mean?

The easiest way of interpreting the resulting number is a percentage; multiply by a hundred. We get 0.37% chance - it's extremely unlikely that these swordsmen can kill all of the hammerers in a single combat round. Note that this is the chance of precisely five kills succeeding, and is actually marginally lower than the probability that all the dwarves will be wiped out, though - because if six, seven, eight, nine, ten, or eleven attacks succeeded, that would do the trick just fine as well! Doing cumulative probabilities (X > x or X <= x or whatever) is probably easiest done with a specially made calculator - which will just calculate the binomial probabilities for all possible options and add them together for you.

Less than one percent chance seems pretty poor, really - but then, why were you trying to beat down stoic, heavily armed dwarven hammerers with feeble humans anyway?

See you all next time!





This article is part of the Axes and Arithmetic series. You can find part 1 here.
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...