1.1. Uncertainty - JulTob/Data GitHub Wiki

Randomness vs. Uncertainty: The Core of Probability

Randomness is about processes — the world generates outcomes unpredictably.
Uncertainty is about knowledge — we lack full information.

Think: a die roll (random process) vs. not knowing if the die landed on 3 or 4 (uncertainty).

Probability as a Consistent Language for Uncertainty

A probability model assigns a number to how plausible each outcome is, following three axioms:

$$ 0 \le P(A) \le 1, \quad P(\Omega)=1, \quad P(A \cup B)=P(A)+P(B)-P(A\cap B) $$

Common interpretations:

Perspective Meaning Example
Frequentist Long-run frequency 30% defective parts in many samples
Bayesian Degree of belief Prior belief defect rate = 30%, updated with new data
Geometric/Measure Proportion of total “space” Dart hits area covering 0.3 of total
  • Q1: Is “I don’t know tomorrow’s temperature” randomness or uncertainty?
    • Uncertainty (temperature is determined; our knowledge isn’t).
  • Q2: If (P(A)=0.4) and (P(B)=0.5), estimate (P(A∩B)).
    • ≈ 0.2 if independent. (P(A∩B) ≤ 0.4
  • Q3: Why is $(P(A|B)\neq P(B|A))$ generally?
    • Conditioning direction matters—what’s known vs. what’s inferred.

Descriptive Statistics by Measurement Scale

Not all averages are meaningful. Match your summary to the data scale.

Scale Typical statistics Meaningful central tendency Meaningful spread Notes
Nominal Counts, proportions, mode Mode None (just frequencies) Never take means or SDs of labels.
Ordinal Median, percentiles, IQR, rank correlation Median IQR Preserve order; spacing not uniform.
Interval Mean, SD, z-score Mean SD, variance Ratios (×2) meaningless (no true zero).
Ratio Mean, geometric mean, SD, CV Mean or geometric mean SD, CV Ratios and proportions valid.

Descriptive Statistics by Measurement Scale

Not all averages are meaningful. Match your summary to the data scale.

Scale Typical statistics Meaningful central tendency Meaningful spread Notes
Nominal Counts, proportions, mode Mode None (just frequencies) Never take means or SDs of labels.
Ordinal Median, percentiles, IQR, rank correlation Median IQR Preserve order; spacing not uniform.
Interval Mean, SD, z-score Mean SD, variance Ratios (×2) meaningless (no true zero).
Ratio Mean, geometric mean, SD, CV Mean or geometric mean SD, CV Ratios and proportions valid.

Minimal Pandas Examples

import pandas as pd

# Example dataset
df = pd.DataFrame({
    "color": ["red","blue","blue","red","green"],
    "satisfaction": [1,2,3,4,5],
    "temp_C": [20,22,19,23,21],
    "income": [30_000, 50_000, 45_000, 70_000, 60_000]
})

# Nominal
df["color"].value_counts(normalize=True)

# Ordinal
df["satisfaction"].median()

# Interval
df["temp_C"].mean(), df["temp_C"].std()

# Ratio
df["income"].mean(), df["income"].std() / df["income"].mean()  # CV
  • Q1: For “favorite color,” what valid descriptive statistic exists?
    • → Mode or frequency table only.
  • Q2: For “pain level (1–5),” should you compute a mean?
    • → No, use median or percentiles (ordinal scale).
  • Q3: For “age in years,” which measure of spread is valid?
    • → Standard deviation or coefficient of variation (ratio scale).