liveBook · Manning

Probability theory

As explained in Grokking Statistics

Probability is the mathematical framework for quantifying the likelihood of possible outcomes under uncertainty.

Probability theory gives uncertainty a number. Instead of demanding one certain answer, it describes how strongly an event is expected to happen. A probability can come from repeated data, informed belief, or a mixture of both; its usefulness depends on the quality of those inputs. section 3.0 section 3.1 section 3.12

Write the probability of an event X as P(X). It ranges from 0 to 1, so 0.7 means a 70% chance. An event and its opposite must total 1: if P(X) is 0.7, then the probability that X does not occur is 0.3. section 3.1

A soaked laptop

Suppose a spilled-on laptop has a 70% chance of recovering. That number might summarize repair data, personal experience, an expert estimate, or all three. It does not promise recovery; it records the strength of the expectation. section 3.1

Repeated trials give probability a concrete meaning. With a coin whose chance of heads is 0.5, 1,000 independent flips should produce roughly 500 heads and 500 tails, not necessarily exactly that many. Random variation remains even when the underlying probability stays fixed. section 3.2

from random import random

heads, tails = 0, 0
p = 0.5 # probability of event (heads)

for i in range(1000):
    if random() < p:
        heads += 1
    else:
        tails += 1

# Should roughly be 500 heads, 500 tails
print(f"HEADS: {heads}, TAILS: {tails}")

Modify p or the number of flips, then compare the observed head count with the expected proportion. The simulation uses a random value from 0 to 1 and counts heads when it falls below p. section 3.2

Not every question can be rerun thousands of times. A single election forecast, for example, combines polls, historical information, assumptions, and judgment. Such probabilities can be useful, but sampling choices, incomplete information, bias, and changing conditions can distort them. section 3.2 section 3.3

Odds offer another way to express belief. If an outcome is believed to happen four times as often as it fails, its odds are 4 to 1 and its probability is O(X) / (1 + O(X)) = 4 / 5 = 0.8. Converting odds makes competing claims easier to compare on the same 0-to-1 scale. section 3.3

Probability distributions extend a single chance into a model of possible outcomes:

  • Discrete distributions assign probabilities across a finite set, such as true or false, product colors, or successes in fixed trials. section 3.12
  • Continuous distributions model values with effectively infinite possible outcomes, such as adult height or time between views. section 3.12
  • Binomial, beta, Poisson, and exponential distributions model fixed-trial successes, success rates, event counts, and time between events. section 3.12
  • Monte Carlo simulation draws random values from distributions to model real-life problems. section 3.12

How Grokking Statistics covers it

How deep it goes
Defines probabilities, complements, repeated trials, belief-based estimates, and odds conversion before surveying distributions and simulation.
Examples
Uses a water-damaged laptop, 1,000 coin flips, election forecasts, sports betting odds, and stock-market beliefs.
What it assumes
Teaches probability from zero without assuming statistics or programming knowledge.
What you can do after
Evaluate/understand probability statements as numeric uncertainty grounded in data, beliefs, or both.
How it connects
Connects probability to probability distributions, odds, Monte Carlo simulation, hypothesis testing, machine learning, and sampling.

Also explained in

Compare how 16 books explain probability theory →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Statistics. The section links point to the parts of the book it draws on.