stats-lab probability & statistics, visual

1. Probability — Venn

$P(A\cup B) = P(A) + P(B) - P(A\cap B)$. Independence holds when $P(A\cap B)=P(A)P(B)$.

P(A∪B)
P(A|B)
P(B|A)
independent?

2. Discrete distributions

PMF + CDF. Mean, variance, mode shown — try to predict them before you read.

E[X]
Var[X]
mode

3. Continuous distributions

PDF in colour, CDF overlay (toggle). Integrate the PDF over an interval to read a probability.

E[X]
Var[X]

4. Sum of independent variables

Density of $X+Y$ is $(f_X * f_Y)$, the convolution. Two uniforms → triangle. Two normals → wider normal.

samples20,000

5. Central Limit Theorem

Sample-mean histogram from any reasonable source converges to $\mathcal{N}(\mu, \sigma^2/n)$.

6. Bayes — base-rate fallacy

1000 people. Drag prior, sensitivity, specificity. Watch how rare diseases stay rare even after a positive test.

P(D | +)
P(D | −)

7. Maximum likelihood

Fix some data. Slide the parameter. The likelihood peaks at the MLE — for an i.i.d. normal sample, that's the sample mean.

log-likelihood
MLE

8. Confidence intervals

100 random samples from $\mathcal{N}(0,1)$, 100 intervals. Long-run coverage should match nominal.

coverage

9. Hypothesis test & p-value

Red shade: Type I (α). Orange shade: Type II (β). Drag $\delta$ and $c$ to feel the trade-off.

α
β
power
p-value

10. t-distribution vs Normal

Heavier tails when $df$ is small. As $df\to\infty$ it converges to $\mathcal{N}(0,1)$.

tail (t)
tail (N)

11. Linear regression

Drag points. The OLS line minimises $\sum(y-\hat y)^2$. Watch $R^2$ collapse when you add an outlier.

slope $\hat\beta_1$
intercept $\hat\beta_0$
$R^2$
RMSE

12. Monte Carlo $\pi$

Fraction of darts inside the quarter circle, times 4. Error shrinks like $1/\sqrt N$.

thrown0
inside0
$\hat\pi$

13. Random walks

Symmetric walks spread like $\sqrt t$; a tiny drift dominates eventually.