Presets
Playback
Population
Shape of the measured variable v whose sample mean is studied.
Sampling
Models
Colour the cloud by
Projection
Layers
Model checks
The science
What the lab does
A synthetic population of N rows (up to 50,000) is generated in your browser: three features x1, x2, x3 from K Gaussian clusters with equicorrelation rho, a response y = 2 + 1.5 x1 - 0.8 x2 + 0.4 x3 + 3a sin(1.3 x1) + eps (a = non-linear slider) and one measured variable v with a chosen shape. Every number below is computed from this finite population, so the "true" values are exact, not asymptotic.
Sampling distribution and the central limit theorem
A simple random sample of size n is drawn without replacement and its mean x̄ = (1/n) Σ v_i is recorded again and again. E[x̄] = μ and Var(x̄) = (σ²/n) (N-n)/(N-1), where the last factor is the finite-population correction and σ² uses 1/N. The CLT says (x̄ - μ)/SE → N(0,1) when the variance is finite; the skewness of the mean shrinks like γ/√n, so skewed or heavy-tailed populations need larger n. The yellow curve is the normal law N(μ, SE²); the bars are the measured histogram.
Regression (ordinary least squares)
On the focus sample, β̂ = (XᵀX)⁻¹ Xᵀy with an intercept column; R² = 1 - SSE/SST. The "Fitted vs actual" graph shows how far a linear model gets; raise the non-linear slider and R² falls because the model is misspecified, not because of noise. Strongly correlated features inflate the standard errors s²(XᵀX)⁻¹ (collinearity).
PCA
The sample covariance Σ = (1/(n-1)) Σ(x - x̄)(x - x̄)ᵀ is diagonalised, Σ v = λ v; the arrows have length 2√λ along the eigenvectors, and the scree graph shows λ_i / Σλ. Eigenvectors are found with Jacobi rotations and the top one is cross-checked by power iteration.
k-means clustering
Lloyd's algorithm minimises Σ ||x - c_k||² on standardised features, seeded by k-means++; one assignment/update step is shown every 0.4 s. It only finds a local minimum. The elbow graph shows inertia for k = 1..8 on the same sample. "Purity" is the fraction of points whose k-means cluster is dominated by their true cluster (label permutation does not matter).
Bias-variance trade-off
For a separate 1-D problem y = sin(2.4 t) + 0.4 t + eps, polynomials of degree d (ridge penalty λ on non-constant terms, β̂ = (XᵀX + nλI)⁻¹ Xᵀy) are fitted to 60 independent training sets. Then E[(y - f̂)²] = bias² + Var(f̂) + σ². Low degree: high bias; high degree: high variance; a ridge penalty trades one for the other.
Independent checks shown in the panel
- SD of 1,500 fresh sample means vs the closed form above.
- Normal equations vs a Gram-Schmidt QR solver, plus orthogonality of the residuals to every design column.
- Sum of PCA eigenvalues vs trace of the covariance, and Jacobi vs power iteration.
- Measured test error vs bias² + variance + σ² at the chosen degree.
Honest simplifications
The data are synthetic Gaussian mixtures with three features; real big data are messy, high-dimensional and often stored across machines. Everything here runs on one browser thread (up to 50,000 rows), so "big" means large enough for the statistics to behave as in theory, not terabytes. Bias and variance are Monte-Carlo estimates from 60 replicates, so tiny values carry visible noise. Heavy-tailed populations (t with 3 degrees of freedom) have finite variance but very slow convergence of the CLT.
What to try
- Preset "CLT: skewed, tiny sample", then drag n from 5 to 200 and watch the histogram turn into the yellow bell curve and the skew readout fall.
- Pick "Heavy tails" and compare the tails of the histogram with the normal curve at n = 30 and n = 500.
- Increase N to 50,000 while keeping n fixed: the standard error barely changes (the finite-population factor is almost 1), unlike when n is close to N.
- Set cluster separation to 0 and watch k-means purity drop to chance; set it to 6 and see the elbow at the true K.
- Raise correlation to 0.9 and see PC1 take most of the variance; raise the non-linear term and see R² fall.
- Set degree 9 with lambda = 0, then raise lambda to 0.02: variance collapses while bias grows only slightly.