Bayes Cube — P(E|H), P(H), P(E|¬H)

Enter all three values to plot a point
View
P(H|E) >

Bayes’ theorem

Bayes’ theorem relates the values of four probabilities and can be derived from the identity for conditional probability. The identity for conditional probability holds that for any two propositions A and B, the probability that A given B is equal to the probability that A & B divided by the probability that B. This can be seen easily with the following Venn diagram:

Venn diagram of A and B Two overlapping circles, A and B, inside a rectangle standing for the sample space. Their overlap, A & B, is shaded. sample space A B A & B

When we conditionalise on B, we set aside the entire sample space except for what is contained in the B space. So the probability of A conditional on B is equal to what fraction of the remaining sample space satisfies A, i.e. what fraction of B is satisfied by both A and B. That is, satisfied by A & B. This fraction is of course expressed by P(A & B)/P(B).

From this identity it follows that P(A | B) ⋅ P(B) = P(A & B). But since P(A & B) = P(B & A), P(B | A) ⋅ P(A) = P(A | B) ⋅ P(B). Dividing by P(B), we obtain

P(A | B) = P(B | A) ⋅ P(A)P(B),

the canonical form of Bayes’ theorem which is reflected in cube two.

We can also use some basic probability theory to substitute any one of these values for P(A | ¬B), thus leading to four possible cubes, as presented. This is done by recognising that P(A) = P(A & B) + P(A & ¬B). In other words, the fraction of the total sample space occupied by A is the fraction of the total sample space occupied by A and B plus the fraction of the total sample space occupied by A and not‑B. We can then use the identity for conditional probability to solve for P(A | ¬B) as follows:

P(A) = P(A | B) ⋅ P(B) + P(A | ¬B) ⋅ P(¬B)
P(A) − P(A | B) ⋅ P(B)1 − P(B) = P(A | ¬B)

This can then be re-arranged. See boundary proofs.

Bayes’ rule

Bayes’ rule is an interpretation of Bayes’ theorem with manifold consequences for statistics, decision theory, philosophy, and more. According to Bayesian epistemology, a rational agent has degrees of belief or credences in certain propositions. These credences can be represented by probabilities. For example, when an agent holds that P(a) = 1, they are certain that a is true, while when they hold that P(a) = 0, they are certain that a is false. Bayes’ rule governs how these credences change as evidence is gathered. As some piece of evidence E is obtained, the probability of H should be ‘updated’ to the probability of H conditional on E, represented by P(H | E). This process, called Bayesian updating, is a rudimentary model of scientific reasoning and has been extended with great success to various domains such as machine learning.

Bayesian updating is not without its limits, however. Some doubt that Bayesian methods can capture the sort of reasoning routinely employed in science. In particular, the input ‘prior’ probabilities can give the appearance of inscrutability or arbitrariness. While Bayes’ rule might give a semblance of objectivity to how our credences are supposed to shift under the pressure of evidence, it does not tell us what our credences should be in the first place. This point is often obscured because in cases where a scientific hypothesis h strongly predicts some surprising or unlikely data e, the probability of e conditional on h will be dramatically higher than the probability of e conditional on ¬h. So observing e gives a major probabilistic update in favour of h. But mere probabilistic amplification is not all there is to scientific confirmation. Instead, very well-tested scientific theories are often thought to be probably true, not merely more probably true than they were previously. For the stronger condition to be satisfied, P(e | h) must beat P(e | ¬h) by a greater factor than P(¬h) beats P(h). But because of the specificity and unlikeliness of e, and because h predicts e very strongly, P(h) is itself bound to be extremely low. So while each ratio is independently somewhat scrutable, comparing them seems hopeless. This website exists partly out of a desire to find a way to make intuitive this very conundrum.

References and further reading

Contact

For any feedback and suggestions, please email

Boundary proofs

Real numbered values for the input variables can of course be contrived such that applying Bayes’ theorem yields a value for P(H | E) (or indeed the variable left out on that particular cube) which is above 1 or below 0. These are incoherent probability assignments and such points cannot be accessed on the cubes. We can identify the prohibited regions by solving for the lower and upper bounds of the input variables such that P(H | E) and the remaining variable stay greater than or equal to 0 and less than or equal to 1.

For the sake of not making the equations ugly later down the line, let’s stick with:

w = P(H),x = P(E | H),y = P(E | ¬H),z = P(E)

Something which will be useful is a formula which relates all of these variables. Let’s start with the rule for conditional probabilities:

wx = P(H & E) = P(H | E)z
wx = P(H | E)z
P(H | E) = wxz

This is our canonical representation of Bayes’ theorem going in. Now, consider:

z = P(H & E) + P(¬H & E)
z = wx + P(¬H)P(E | ¬H)
z = wx + y(1 − w)

This gives us our formula relating the variables. Now, let’s solve for the prohibited regions in each cube.

First cube, misses out P(E)

Let’s begin each cube with the bounds for P(H | E). The first step is to solve P(H | E) in terms of our input values: w, x, y.

P(H | E) = wxz
P(H | E) = wxwx + y(1 − w)

So the bounds are:

1 ≥ wxwx + y(1 − w) ≥ 0
wx + y(1 − w) ≥ wx ≥ 0

But all regions on the cube satisfy wx ≥ 0, since its dimensions only include nonnegative real numbers. Taking the remaining inequality:

wx + y(1 − w) ≥ wx
y(1 − w) ≥ 0
y ≥ 0,1 ≥ w

But both of these conditions are satisfied trivially by the cube, for the same reason as above. So with this cube, all we need to worry about are the bounds for P(E). Now this is a bit of a special case since its bounds are not only 1 ≥ P(E) ≥ 0 but 1 ≥ P(E) > 0. Not because P(E) = 0 is incoherent, but because it’s impossible to condition on this evidence. Recall:

z = wx + y(1 − w)

So the bounds for the first cube are:

1 ≥ wx + y(1 − w) > 0

Second cube, misses out P(E | ¬H)

It’s easy to get P(H | E), since it’s already in terms of our input values = w, x, z.

P(H | E) = wxz

So the bounds are:

1 ≥ wxz ≥ 0
z ≥ wx ≥ 0

But as in the previous section, wx ≥ 0 is trivially satisfied by the cube. All we need to worry about is the lower bound: z ≥ wx.

Turning now to P(E | ¬H). Solving for y in our above equation:

y = z − wx1 − w

So we also have the following bounds:

1 ≥ z − wx1 − w ≥ 0
1 − w ≥ z − wx ≥ 0

We have already specified z ≥ wx as a lower bound on z. So,

1 + wx − w ≥ z
1 + w(x − 1) ≥ z

Thus, our bounds for the second cube are:

1 + w(x − 1) ≥ z ≥ wx

But also, z > 0

Third cube, misses out P(E | H)

Solving for x from our given equation:

x = z − y(1 − w)w

This allows us to solve for P(H | E) in terms of our input variables = w, y, z

P(H | E) = wxz
P(H | E) = w(z − y(1 − w)w)z
P(H | E) = z − y(1 − w)z

So, our upper and lower bounds on P(H | E) are

1 ≥ z − y(1 − w)z ≥ 0
z ≥ z − y(1 − w) ≥ 0

Taking the first inequality:

z + y(1 − w) ≥ z
y(1 − w) ≥ 0

But this is already what we established with the first cube, and was taken care of by the limits on the input values. Taking the second inequality, we now have a lower bound for z

z ≥ y(1 − w)

Turning now to P(E | H), our bounds will be:

1 ≥ z − y(1 − w)w ≥ 0
w ≥ z − y(1 − w) ≥ 0

But we already know that z − y(1 − w) ≥ 0, so we focus on the upper bound for z

w + y(1 − w) ≥ z

We now have our lower and upper bounds for the third cube:

w + y(1 − w) ≥ z ≥ y(1 − w)

But also, z > 0

Fourth cube, misses out P(H)

Solving for w from our given equation:

z = wx + y(1 − w)
z = wx + y − wy
z − y = wx − wy
z − y = w(x − y)

If x = y, this says that z − y = 0: then z = x = y, and w may take any value at all. E is irrelevant to H, so P(H | E) = P(H), which the input values do not fix. Otherwise x − y is not 0, and we can divide by it:

z − yx − y = w

So our bounds on w are as follows:

1 ≥ z − yx − y ≥ 0

To clear the fraction we multiply through by x − y, and which way the inequalities then face depends on its sign. If x > y, then x − y is positive:

x − y ≥ z − y ≥ 0
x ≥ z ≥ y

If x < y, then x − y is negative, and multiplying by it reverses the inequalities:

x − y ≤ z − y ≤ 0
x ≤ z ≤ y

Both orderings are coherent, so whichever of x and y is the larger, z must lie between them:

min(x, y) ≤ z ≤ max(x, y)

Finally, let’s solve for the bounds on P(H | E)

P(H | E) = wxz
P(H | E) = x(z − y)z(x − y)
1 ≥ x(z − y)z(x − y) ≥ 0

Since z > 0, the denominator z(x − y) has the sign of x − y. If x > y, it is positive, and so

z(x − y) ≥ x(z − y) ≥ 0

Taking the first inequality:

z(x − y) ≥ x(z − y)
xz − yz ≥ xz − xy
xy ≥ yz
x ≥ z

This is already ensured by the bounds on z stated above.

Taking the second inequality:

x(z − y) ≥ 0

Since x must be nonnegative as one of our input values, the only way this can be violated is if y > z. But this is already prohibited by our lower bound on z stated above.

If x < y, the denominator is negative, and the inequalities reverse:

z(x − y) ≤ x(z − y) ≤ 0

Taking the first inequality:

z(x − y) ≤ x(z − y)
xz − yz ≤ xz − xy
xy ≤ yz
x ≤ z

This too is already ensured by the bounds on z stated above.

Taking the second inequality:

x(z − y) ≤ 0

Since x is nonnegative, the only way this can be violated is if z > y. But this is already prohibited by our upper bound on z stated above.

So, the bounds for the fourth cube are simply z > 0, and min(x, y) ≤ z ≤ max(x, y): that is, x ≥ z ≥ y where x > y, y ≥ z ≥ x where x < y, and z = x = y where x = y.