The law of total probability
The law of total probability shows and calculates the relations between marginal, conditional and joint probabilities.
Visualizing the relationship
This desitino tree illustrates the law of total probability and how it connects marginal, conditional and joint probabilities:
We recall that the symbol (‘) in for example P(A’) relates to the complement of an event.
What is the probability that you get a defective part when selecting at random from a production where:
- Machine A produces 70% of the units with an error rate of 5%
- Machine B produces 20% of the units with an error rate of 15%
- Machine C produces 10% of the units with an error rate of 20%
Machine A produces 70% of all units of which 5% are defective, so this its’ partition to the total amount of defective units is 0.7 x 0.05 = 0.035. In order to get the total probability, we do the same calculation for the two other machines in order to get the total probability:
Machine A: (0.7 x 0.05) + Machine B: (0.2 x 0.15) + Machine C: (0.1 x 0.2) = 0.085.
So, the probability of randomly selecting a defective part is 8.5%. To generalize this into a formula we can say:
The law of total probability visualized
Let’s visualize through an example:
The police run a control for “drunk-driving” a Saturday night in a specific area.
The test used for controlling the drivers’ alcohol percentage has a false positive rate of 2% and a false negative rate of 1%. It is informed that 5% of all drivers in this specific area at these specific hours during Saturdays exceed the allowed alcohol percentage.
Say that we randomly select a driver and that he/she tests positive. What is the probability that he/she actually does exceed the allowed alcohol percentage in that given moment? Can we trust the test?
Apparently, the test seems reliable with low error rates, but now see what happens. Let’s apply a fictive number for the population of 10,000:
The proportion of drivers testing correctly positive, meaning the proportion of drivers that test positive and do exceed the allowed alcohol percentage can be seen directly from the decision tree.
190 persons will test false positive and the total number of positive tests are 190 + 495= 685. Out of these 685 persons, 190 are false positive (≈28%). So, the apparently low error rates result in a 28% error when given a positive test. The test is therefore not reliable.
Bike tires example
Say that I need new tires for your blue mountain bike.
If the tires are produced by company A there is a 99% chance that they will last 1,500 km. until they are worn down to a certain and measurable level.
Tires produced by company B offers a 92% probability of lasting 1,500 km.
80% of the tires are produced by company A.
What is the probability that your tires will last 1,500 km?
Let A be the event that the tires last 1,500 km.
- P(1,500) = P(1,500|A) * P(A) + P(1000|B) * P(B)
- P(A) = (0.99 * 0.80) + (0.92 * 0.20) = 0.976
I have 97.6% chance that my tires will last 1,500 km.
- The bike tire example above is inspired by Liberty Munson (Principal Psychometrician at Microsoft)
- Actuarial, Math, Stat Path: Lesson 7 Law of Total Probability
- edX.org courses on probability
Freelance Data Analyst
+34 616 71 29 85
Spain: Ctra. 404, km 2, 29100 Coín, Malaga
Denmark: c/o Musvitvej 4, 3660 Stenløse
Drop me a line
What are you working on just now? Can I help you, and can you help me?
Learning statistics. Doing statistics. Freelance since 2005. Dane. Living in Spain. With my Spanish wife and two children.
Connect with me
What they say
20 years in sales, analysis, journalism and startups. See what my customers and partners say about me.