Home / Probability & statistics
σ

Probability & statistics

Probability, distributions, samples, tests, correlation and the most common statistical mistakes.

Bayes' theorem and false positives: the diagnostic test case

Bayes' theorem applied to a test with 99% sensitivity: why a positive result can be wrong in 5 cases out of 6 and how to update the estimate step by step.

4 min

The binomial distribution: counting successes in n trials

When to use the binomial, how to compute P(X = k) with the binomial coefficient, mean and variance, and a full quality control example worked in Python.

5 min

The birthday paradox and collisions in identifiers

Just 23 people give over a 50% chance of a shared birthday. The calculation, the approximate formula and what it teaches about hashes and random IDs.

4 min

The central limit theorem explained with a simulation

Why sample means tend towards a normal even with skewed data, what the standard error is, when 30 cases are not enough and a hands-on test in Python.

4 min

The chi-square test: goodness of fit and independence

How the chi-square test checks a die or compares error rates between groups, with step-by-step calculations, degrees of freedom and conditions of use.

5 min

Conditional probability and independence explained with examples

How to compute conditional probability, what independence between events really means and why confusing P(A|B) with P(B|A) leads to serious mistakes.

5 min

Confidence intervals: how to compute them and what they mean

Confidence intervals for means and proportions with worked numbers, the correct reading of 95%, the bootstrap method and common interpretation errors.

4 min

Correlation is not causation: confounders, reversals, selection

The five alternative explanations of a correlation, from confounders to reverse causation to selection bias, and methods that get closer to proof.

4 min

Hypothesis tests and p-values: what they say and what they don't

Null hypothesis, significance level and p-value explained with a suspicious coin, plus the misinterpretations to avoid and the role of effect size.

4 min

The law of large numbers and the gambler's fallacy

What the law of large numbers really guarantees, why chance does not «make up» for losing streaks and how small samples produce extreme results more often.

4 min

Mean, median and mode: which measure to use and when

Arithmetic mean, median, mode, trimmed, geometric and harmonic mean: how to compute them, how they react to extremes and which to choose case by case.

5 min

Measures of spread: standard deviation, IQR and outliers

Range, variance, standard deviation with n − 1, interquartile range, MAD and coefficient of variation: how to measure variability and spot outliers.

5 min

Monte Carlo simulation in Python: estimating with chance

How to use Monte Carlo simulation to estimate π and a project's duration with NumPy, how precise the estimate is and which typical mistakes to avoid.

5 min

The Monty Hall problem: why you should switch doors

The Monty Hall problem explained with three arguments and a Python simulation: switching wins 2 times out of 3, and here is where the error comes from.

5 min

Multiple comparisons and p-hacking: too many tests, false results

Why with 20 tests a false positive has a 64% chance, how the Bonferroni, Holm and Benjamini-Hochberg corrections work and how to avoid p-hacking.

4 min

The normal distribution and the 68-95-99.7 rule

The bell curve explained in practice: z-scores, the 68-95-99.7 rule, computing tails with Python and the real cases where assuming normality is a mistake.

4 min

Pearson and Spearman correlation: reading it without errors

What the correlation coefficient measures, Pearson versus Spearman, Anscombe's quartet and the traps of outliers and nonlinear relationships.

4 min

The Poisson distribution: counting events over time

When to use the Poisson distribution for tickets, errors and requests, how to compute probabilities, set alert thresholds and recognise overdispersion.

5 min

What probability is: three interpretations and the axioms

Classical, frequentist and subjective probability compared, plus Kolmogorov's axioms and the rules that follow from them, explained with dice and cards.

5 min

Random variables, expected value and variance made clear

What a random variable is, how to compute expected value and variance, linearity of expectation and why the mean alone is never enough to assess a risk.

5 min

Regression to the mean: why extremes do not repeat

Why an extreme result tends to be followed by a more ordinary one, how this misleads evaluations of interventions and how a control group protects you.

5 min

Sampling: methods, sample size and biases

Simple random, systematic, stratified and cluster sampling, how large a sample should be and how to recognise selection, non-response and coverage bias.

5 min

Simple linear regression: least squares and residuals

How to compute a regression line with least squares, what slope, intercept and R² mean, how to read the residuals and why extrapolating is risky.

5 min

Simpson's paradox: when aggregated data reverse

A group that is better in every subgroup can be worse overall: Simpson's paradox with a numerical example, its causes and which figure to trust.

4 min

Type I and type II errors and statistical power

False positives and false negatives in tests, what α, β and power are, and how to compute an A/B test's sample size in advance with a worked example.

5 min