Statistics runs probability backwards: from one sample, recover a best guess (point estimate), an honest interval, and a ship/no-ship decision with a stated error rate, and every procedure silently trusts an assumption.
Estimators: judge by MSE
- Estimator: a recipe turning a sample into a number; being random, it has a sampling distribution. Every property below is a property of that distribution.
- Bias =
E[theta_hat] - theta; Variance = spread across samples; MSE =bias^2 + Varis the only thing that matters when choosing between estimators. - Consistency:
theta_hat -> thetaasn -> infinity. Independent of unbiasedness: “always reportX_1” is unbiased but never converges; the MLE variance is consistent but biased at everyn. - Bias can pay: with
mu=10,sigma=10,n=4, shrinking to0.8·xbarscores MSE 20 vs 25 for plainxbar. Optimalc* = mu^2/(mu^2+sigma^2/n)needs the answer, so nobody uses it.
one estimator (random variable)
/ \
Bias Variance
\ /
MSE = bias^2 + Var <- optimize this, not bias alone
Maximum likelihood and the divisor
- MLE: pick the parameter that makes the observed data most probable. Recipe: write likelihood, take log, differentiate, set to 0, check 2nd derivative < 0.
- Bernoulli:
p_hat = k/n. Gaussian:mu_hat = xbar,sigma^2_hat = (1/n)·sum(x_i - xbar)^2. - MLE variance is biased low:
E[sigma^2_MLE] = ((n-1)/n)·sigma^2, becausexbarminimizessum(x_i - c)^2by construction, understating spread around the truemuby one degree of freedom. - Divisor is a choice of loss:
/n= MLE,/(n-1)= unbiased,/(n+1)= minimum-MSE. On[2,4,4,4,6](SS=8): 1.60, 2.00, 1.33. - Jensen catch:
s^2is unbiased forsigma^2, butE[s] < sigma(square root is concave). Unbiasedness dies under nonlinear transforms. - Assumes correct model, independence, identical distribution, interior smooth maximum. The
n-1fix is exact only under independence.
Intervals and p-values
- CI for a mean:
xbar +/- t_{0.975,n-1}·s/sqrt(n). SE =s/sqrt(n)is the spread of the estimate, not of rows; SE shrinks withn,sdoes not. - Correct reading: the procedure covers the truth 95% of the time. Wrong: “95% chance the truth is in this interval” (frequentist parameter is fixed, not random).
- PI (next single observation):
xbar +/- t·s·sqrt(1+1/n), ~10x wider atn=100. Stakeholders asking “will a user convert 50-54%?” mean the PI; handing them the CI drives over-confident forecasts. - 95% CI = null values a two-sided
alpha=0.05test fails to reject (same pivot only): excludes zero <->p < 0.05. - p-value =
P(data-or-worse | H0, pre-committed stopping rule). NOTP(H0 | data)(that needs a prior), not “probability of chance”, not replication probability. - Significance != truth: prior 0.10 + power 0.80 -> 36% of “wins” are false; drop power to 0.50 -> 47%. Underpowered studies make discoveries less likely to be real.
Errors and A/B sizing
- Four cells: Type I (false alarm, rate
alpha, you set it); Type II (miss, ratebeta); power =1-beta. “Fail to reject” is not “accept”. - MDE: the smallest effect worth detecting; you cannot pin
betawithout it. - Sample size per arm:
n = 2·sigma^2·(z_a + z_b)^2 / delta^2 ≈ 16·sigma^2/delta^2(planning docs use 7.84888, not 16). For a proportion swap2·sigma^2 -> p1·q1 + p2·q2; using the smaller variance twice quietly delivers 76% power, not 80%. - Scaling law:
n ~ 1/delta^2, so halving the detectable effect quadruples the traffic.
| Relative lift | delta | n per arm |
|---|---|---|
| 20% | 0.0100 | 8,155 |
| 10% | 0.0050 | 31,231 |
| 5% | 0.0025 | 122,121 |
| 1% | 0.0005 | 2,996,695 |
A/B traps (nothing errors out)
- Randomization unit sets what
nmeans. Randomize by user (UI changes), session (invisible backend), cluster (interference). Analyze at a finer level and the design effect1 + (k-1)·rho_intrainflatesn; understated SE turnedp=0.03intop=0.26. - Peeking: fixed-
nbroken. 5 looks -> 14.2% Type I; continuous monitoring hitsp<0.05with probability 1 eventually. Fix with group-sequential / mSPRT / confidence sequences (10-25% more sample). - Multiple testing:
FWER = 1 - 0.95^m= 64% atm=20. Bonferroni (alpha/m, any dependence) costs 1.9x sample atm=20; BH controls the false-discovery fraction for screening. - Novelty vs primacy: effect decays vs grows; plot by days-since-exposure, not calendar day. Interference: treatment steals control’s supply; fix with cluster/switchback (structural, not statistical).
- CUPED:
Y - theta·(X - E[X]),theta* = Cov(X,Y)/Var(X), cuts variance toVar(Y)(1-rho^2).rho=0.6-> 1.56x effectiven.Xmust be strictly pre-randomization (else it is a mediator). - Bootstrap: resample the randomization unit with replacement, recompute the statistic, use the spread. Fails silently on max/min, dependent rows, tiny
n. - Simpson’s paradox: a treatment can win every subgroup and lose overall (weighted averages, different weights). Adjust for a confounder, never a mediator or collider — a causal (DAG) claim no test can make for you.