## Monday, March 10, 2014

### Conditional Probability

Here is a clever, interactive, simulation display of conditional probability from Victor Powell, via flowingdata.

Balls fall from the sky, uniformly distributed across the display window. Some hit a red shelf of adjustable width. Here it is set at a width so that
P(A) = 20% of all the falling balls hit the red shelf.
Another lower blue shelf, overlapping a bit with the red one, is set so that
P(B) = 12% of the balls hit the blue shelf.
A mere P(A and B) = 6% of the balls hit both shelves, indicated by the mixture of red and blue to get purple. But, as the simulation says,
"If we have a ball and we know it hit the red shelf, there's a 30.0% chance it also hit the blue shelf" and
"If we have a ball and we know it hit the blue shelf, there's a 50.0% chance it also hit the red shelf".

Below are connected bars showing, by their length, the color composition of the dropped balls. We can easily see how these proportions are obtained by visually estimating that fraction that purple makes up of the balls that hit the red shelf. That is the ratio, purple / (red + purple) = 30% or what fraction purple makes up of the balls that hit the blue shelf. This is the ratio, purple / (purple + blue) = 50%.