Probability

Dated Sep 17, 2026; last modified on Thu, 17 Sep 2026

Probability is a Fraction of a Finite Set

A simplified definition: a probability is a fraction of a finite set. For example, in the 2024 GSS survey, of the 3,986 respondents, 42 were bankers. If we choose a person from this population at random, the probability that they are a bank teller is 1.054%.

The General Social Survey (GSS) touts itself as the only full-probability, personal-interview survey designed to monitor changes in both social characteristics and attitudes currently being conducted in the US.

"""
~/blog/content/mathematics $ uv run --project probability_and_stochastic_systems python -m probability_and_stochastic_systems.sample_space_and_probability.probability_defn
"""

from __future__ import annotations

import pandas as pd

from ..data.gss_2024.gss import gss_2024


def probability(A: pd.Series[bool]):
    """Computes the probability of a proposition, A."""
    return A.mean()

def print_probability(A: pd.Series[bool], label: str):
    print(f"{A.sum()} / {A.count()} are {label}; prob = {probability(A):.4g}")

print_probability((gss_2024["indus10"] == 6870), "bankers")     # 0.01054
print_probability((gss_2024["polviews"] <= 3), "liberals")      # 0.2958
print_probability((gss_2024["partyid"] <= 1), "democrats")      # 0.3016

References

  1. 1. Probability — Think Bayes. Allen Downey. allendowney.github.io . Accessed Sep 17, 2026.
  2. About the GSS. gss.norc.org . Accessed Sep 17, 2026.