liveBook · Manning

Conditional probability

As explained in Fabulous Adventures in Data Structures and Algorithms

Conditional probability is the probability of an event given that another event or condition is known to hold.

Conditional probability measures how strongly an event is believed when another event or condition is already known. The notation P(S|C) means the probability of sneezing given a cold; the vertical bar means “if,” not “or.” section 13.1

Relate conditional probability to the other parts of a probability model:

  • Multiply a prior by a conditional probability to obtain a joint probability: P(C) × P(S|C) = P(C&S). section 13.1
  • Represent conditional probabilities as likelihood functions that take a condition and return a distribution. section 13.6
  • Use the joint distribution, filtering, and projection to recover a posterior probability such as P(C|S). section 13.3

Cold and sneezing

Among 1,000 people with colds, 860 sneezed, so P(S|C) is 86%. Among all 10,000 respondents, 860 both had colds and sneezed, giving P(C&S) = 8.6%. After observing a sneeze, the probability of a cold becomes P(C|S) = 860/1,130, or about 76.1%. section 13.1

In a discrete-probability program, a prior distribution and likelihood function can be combined into a joint distribution. Filtering for an observed effect and projecting the possible causes computes the posterior conditional distribution. section 13.3

Table 13.1 A survey of 10,000 respondents organized in a marginal table

Cold: YES

Cold: NO

Total

Sneezed: YES

860

270

1,130

Sneezed: NO

140

8,730

8,870

Total

1,000

9,000

10,000

Browse the marginal survey table to verify how conditional, joint, and marginal probabilities arise from the same counts. section 13.1

How Fabulous Adventures in Data Structures and Algorithms covers it

How deep it goes
Develops notation, tables, probability identities, and filter-projection mechanics, stopping short of continuous distributions.
Examples
Uses a 10,000-person cold-and-sneeze survey and a C# posterior function returning weights of 27 to 86.
What it assumes
Assumes basic probability notation while defining priors, likelihoods, joint probabilities, and posterior probabilities through examples.
What you can do after
Apply it via generic discrete-distribution operations to compute posterior beliefs from priors and likelihood functions.
How it connects
Connects prior probability, likelihood functions, joint probability, posterior probability, discrete distributions, and Bayes’ theorem.

Also explained in

Compare how 11 books explain conditional probability →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fabulous Adventures in Data Structures and Algorithms. The section links point to the parts of the book it draws on.