02.08 Lesson 8 of 12

1 h

Probability & Conditional Probability

Represent uncertainty with events and probabilities, then update a probability when information about an event is known.

By the end of this lesson

You will be able to

  • Define an event and a sample space.
  • Calculate a conditional probability from observed counts.
  • Distinguish independence from mutually exclusive events.
  • Explain Bayes’ rule as probability updated by evidence.

Probability is a measure of uncertainty

An event is a set of outcomes from a sample space. For equally likely outcomes, P(A) = favourable outcomes / total outcomes. With observed data, a simple empirical estimate is count(A) / n. Probability values range from 0 to 1. Events are independent when learning that one occurred does not change the probability of the other.

rides = [0, 1, 1, 0, 1, 1, 0, 1]
observed_rate = sum(rides) / len(rides)
print(observed_rate)  # 0.625

Condition on the information you have

Conditional probability is P(A | B) = P(A and B) / P(B), provided P(B) > 0. The denominator is the condition: the population or cases where B is known to be true. Bayes’ rule reverses the condition: P(A | B) = P(B | A)P(A) / P(B). It combines a prior probability with how likely the evidence is under that event.

# A small table of observed counts
# rain: 30 rainy hours, 70 dry hours
# high_demand among rainy: 18
# P(high_demand | rain) = 18 / 30
print(18 / 30)  # 0.6

Apply what you learned

Exercise

Calculate conditional rates from a table

Use a made-up two-way table to make sure the condition is always reflected in the denominator.

  1. Create a table with 40 rainy hours and 60 dry hours.
  2. Record 24 high-demand rainy hours and 18 high-demand dry hours.
  3. Calculate P(high demand | rain).
  4. Calculate P(rain | high demand) and explain why it is different.
  5. State whether the counts alone prove that rain causes high demand.
Done when

You calculate P(high demand | rain) = 24/40 = 0.6 and P(rain | high demand) = 24/42; your explanation says association alone does not establish causation.

Free references

Study resources

3 links
  1. 01
    Conditional Probability, Clearly Explained Video

    Watch this one video and identify the event used as the condition in each example.

  2. 02
    Conditional probability using two-way tables Article

    Read the worked two-way-table example and calculate the conditional probability in both directions.

  3. 03
    Bayes’ Theorem, Clearly Explained Video

    Watch the standalone derivation after conditional probability; focus on prior, likelihood and posterior.

Check your understanding

Self-test

2 questions
  1. Question 1

    In P(A | B), what does the denominator represent?

  2. Question 2

    If A and B are independent, what is P(A | B)?

Completion check

Move on when

You can calculate a conditional probability in the correct direction and explain why conditioning changes the denominator.

Quick find

Search Michi

Type to search every stage, section, unit, topic and resource.

Enter opens the first result Esc closes

Reference

Keyboard shortcuts

n
Continue to the first unit not passed
j / k
Next / previous unit
1 2 3
Toggle learned, practised, passed
/
Open search
?
Show this help
Esc
Close open panels