Waterfall diagrams and relative odds

Imag­ine a wa­ter­fall with two streams of wa­ter at the top, a red stream and a blue stream. Th­ese streams sep­a­rately ap­proach the top of the wa­ter­fall, with some of the wa­ter from both streams be­ing di­verted along the way, and the re­main­ing wa­ter fal­ling into a shared pool be­low.

unlabeled waterfall

Sup­pose that:

  • At the top of the wa­ter­fall, 20 gal­lons/​sec­ond of red wa­ter are flow­ing down, and 80 gal­lons/​sec­ond of blue wa­ter are com­ing down.

  • 90% of the red wa­ter makes it to the bot­tom.

  • 30% of the blue wa­ter makes it to the bot­tom.

Of the pur­plish wa­ter that makes it to the bot­tom of the pool, how much was origi­nally from the red stream and how much was origi­nally from the blue stream?

if-af­ter(Fre­quency di­a­grams: A first look at Bayes): This is struc­turally iden­ti­cal to the Dise­a­sitis prob­lem from be­fore:

  • 20% of the pa­tients in the screen­ing pop­u­la­tion start out with Dise­a­sitis.

  • Among pa­tients with Dise­a­sitis, 90% turn the tongue de­pres­sor black.

  • 30% of the pa­tients with­out Dise­a­sitis will also turn the tongue de­pres­sor black. <div>

!if-af­ter(Fre­quency di­a­grams: A first look at Bayes): This is struc­turally similar to the fol­low­ing prob­lem, such as med­i­cal stu­dents might en­counter:

You are a nurse screen­ing 100 pa­tients for Dise­a­sitis, us­ing a tongue de­pres­sor which usu­ally turns black for pa­tients who have the sick­ness.

  • 20% of the pa­tients in the screen­ing pop­u­la­tion start out with Dise­a­sitis.

  • Among pa­tients with Dise­a­sitis, 90% turn the tongue de­pres­sor black (true pos­i­tives).

  • How­ever, 30% of the pa­tients with­out Dise­a­sitis will also turn the tongue de­pres­sor black (false pos­i­tives).

What is the chance that a pa­tient with a black­ened tongue de­pres­sor has Dise­a­sitis? <div>

The 20% of sick pa­tients are analo­gous to the 20 gal­lons/​sec­ond of red wa­ter; the 80% of healthy pa­tients are analo­gous to the 80 gal­lons/​sec­ond of blue wa­ter:

top labeled waterfall

The 90% of the sick pa­tients turn­ing the tongue de­pres­sor black is analo­gous to 90% of the red wa­ter mak­ing it to the bot­tom of the wa­ter­fall. 30% of the healthy pa­tients turn­ing the tongue de­pres­sor black is analo­gous to 30% of the blue wa­ter mak­ing it to the bot­tom pool.

middle labeled waterfall

There­fore, the ques­tion “what por­tion of wa­ter in the fi­nal pool came from the red stream?” has the same an­swer as the ques­tion “what por­tion of pa­tients that turn the tongue de­pres­sor black are sick with Dise­a­sitis?”

if-af­ter(Fre­quency di­a­grams: A first look at Bayes): Now for the faster way of an­swer­ing that ques­tion.

We start with 4 times as much blue wa­ter as red wa­ter at the top of the wa­ter­fall.

Then each molecule of red wa­ter is 90% likely to make it to the shared pool, and each molecule of blue wa­ter is 30% likely to make it to the pool. (90% of red wa­ter and 30% of blue wa­ter make it to the bot­tom.) So each molecule of red wa­ter is 3 times as likely (0.90 /​ 0.30 = 3) as a molecule of blue wa­ter to make it to the bot­tom.

So we mul­ti­ply prior pro­por­tions of \(1 : 4\) for red vs. blue by rel­a­tive like­li­hoods of \(3 : 1\) and end up with fi­nal pro­por­tions of \((1 \cdot 3) : (4 \cdot 1) = 3 : 4\), mean­ing that the bot­tom pool has 3 parts of red wa­ter to 4 parts of blue wa­ter.

labeled waterfall

To con­vert these rel­a­tive pro­por­tions into an ab­solute prob­a­bil­ity that a ran­dom wa­ter molecule at the bot­tom is red, we calcu­late 3 /​ (3 + 4) to see that 3/​7ths (roughly 43%) of the wa­ter in the shared pool came from the red stream.

This pro­por­tion is the same as the 18 : 24 sick pa­tients with pos­i­tive re­sults, ver­sus healthy pa­tients with pos­i­tive test re­sults, that we would get by think­ing about 100 pa­tients.

That is, to solve the Dise­a­sitis prob­lem in your head, you could con­vert this word prob­lem:

20% of the pa­tients in a screen­ing pop­u­la­tion have Dise­a­sitis. 90% of the pa­tients with Dise­a­sitis turn the tongue de­pres­sor black, and 30% of the pa­tients with­out Dise­a­sitis turn the tongue de­pres­sor black. Given that a pa­tient turned their tongue de­pres­sor black, what is the prob­a­bil­ity that they have Dise­a­sitis?

Into this calcu­la­tion:

Okay, so the ini­tial odds are (20% : 80%) = (1 : 4), and the like­li­hoods are (90% : 30%) = (3 : 1). Mul­ti­ply­ing those ra­tios gives fi­nal odds of (3 : 4), which con­verts to a prob­a­bil­ity of 3/​7ths.

(You might not be able to con­vert 37 to 43% in your head, but you might be able to eye­ball that it was a chunk less than 50%.)

You can try do­ing a similar calcu­la­tion for this prob­lem:

  • 90% of wid­gets are good and 10% are bad.

  • 12% of bad wid­gets emit sparks.

  • Only 4% of good wid­gets emit sparks.

What per­centage of spark­ing wid­gets are bad? If you are suffi­ciently com­fortable with the setup, try do­ing this prob­lem en­tirely in your head.

(You might try vi­su­al­iz­ing a wa­ter­fall with good and bad wid­gets at the top, and only spark­ing wid­gets mak­ing it to the bot­tom pool.)

todo: Have a pic­ture of a wa­ter­fall here, with no num­bers, but with the parts la­beled, that can be ex­panded if the user wants to ex­pand it.

  • There’s (1 : 9) bad vs. good wid­gets.

  • Bad vs. good wid­gets have a (12 : 4) rel­a­tive like­li­hood to spark.

  • This sim­plifies to (1 : 9) x (3 : 1) = (3 : 9) = (1 : 3), 1 bad spark­ing wid­get for ev­ery 3 good spark­ing wid­gets.

  • Which con­verts to a prob­a­bil­ity of 1/​(1+3) = 14 = 25%; that is, 25% of spark­ing wid­gets are bad.

See­ing sparks didn’t make us “be­lieve the wid­get is bad”; the prob­a­bil­ity only went to 25%, which is less than 5050. But this doesn’t mean we say, “I still be­lieve this wid­get is good!” and toss out the ev­i­dence and ig­nore it. A bad wid­get is rel­a­tively more likely to emit sparks, and there­fore see­ing this ev­i­dence should cause us to think it rel­a­tively more likely that the wid­get is a bad one, even if the prob­a­bil­ity hasn’t yet gone over 50%. We in­crease our prob­a­bil­ity from 10% to 25%.<div><div>

if-be­fore(In­tro­duc­tion to Bayes’ rule: Odds form): Water­falls are one way of vi­su­al­iz­ing the “odds form” of “Bayes’ rule”, which states that the prior odds times the like­li­hood ra­tio equals the pos­te­rior odds. In turn, this rule can be seen as for­mal­iz­ing the no­tion of “the strength of ev­i­dence” or “how much a piece of ev­i­dence should make us up­date our be­liefs”. We’ll take a look at this more gen­eral form next.

!if-be­fore(In­tro­duc­tion to Bayes’ rule: Odds form): Water­falls are one way of vi­su­al­iz­ing the odds form of Bayes’ rule, which states that the prior odds times the like­li­hood ra­tio equals the pos­te­rior odds.

Parents:

  • Waterfall diagram

    Vi­su­al­iz­ing Bayes’ rule as the mix­ing of prob­a­bil­ity streams.

    • Bayes' rule

      Bayes’ rule is the core the­o­rem of prob­a­bil­ity the­ory say­ing how to re­vise our be­liefs when we make a new ob­ser­va­tion.