- A review
- Every stage of an analysis, in the order it happens, with the decision that has to be made at each one and where in the book it was worked through.
- A reference
- The tables you will actually come back for: which test, which distribution, which check, which metric, which model. Built to be scanned rather than read.
- A debrief
- The mistakes that recurred across forty-one capstones, collected in one place, each with the chapter where it did real damage.
- A route map
- What to learn next, in what order, and what to build with it.
Nothing here is new material. Everything here is a decision you now know how to make, arranged so you can find it under pressure on a Tuesday afternoon.
The Shape of a Project
Every project in this book, from a two-sample t-test to a reinforcement learning agent, followed the same path. The path is a loop and not a line, and the loop is the honest part: you clean, you look, you discover the grain is wrong, you go back.
The book is organized along that loop, and it is worth seeing the whole arc at once.
Foundations and data
What statistics is for, types and levels of measurement, describing, visualizing, cleaning, and exploratory analysis. The unglamorous half of every project.
Probability and distributions
Probability rules, random variables, the discrete and continuous families, the Central Limit Theorem, and the distributions that inference is built on.
Sampling and inference
How data gets collected and what that does to what you can conclude. Estimation, intervals, hypothesis testing, and the case studies that put them together.
Association and regression
Covariance through correlation to causation, the regression workflow, diagnostics, logistic and generalized linear models, and four end-to-end regression projects.
Machine learning
The workflow, supervised and unsupervised methods, evaluation, pitfalls, interpretability, reinforcement learning, and a full ML case study.
Time, tools and consequences
Time series and forecasting, advanced topics from Bayesian to MLOps, the tools chapters, and then communicating results and data ethics.
Forty-one capstones
Complete projects on deliberately messy data: testing, sampling, causal design, regression, machine learning, forecasting, and the specialized methods.
The whole pipeline
All of it in one place, plus the mistakes that recurred often enough to be worth naming.
Before the Data: The Question
The most expensive errors in this book were not statistical. They were answering a question nobody asked, or answering a different question from the one that was asked and not noticing.
The four sentences to write before opening the file
- The decision. What will someone do differently depending on the answer? If nothing, stop now, and say so, because that is a useful finding too.
- The estimand. What exactly is being estimated, in one sentence, with units and a population. "Whether the new page is better" is not an estimand. "The difference in seven-day retention between arms, in percentage points, among new signups" is.
- The threshold. How big does the effect have to be before the decision changes? This is a business question and it has to be answered before the data is seen, not after.
- The falsifier. What result would change your mind? An analysis with no answer to this is an exercise in confirmation.
| If the question is | You need | Where it was covered |
|---|---|---|
| What is typical, and how much does it vary? | Descriptive statistics and a distribution | Ch 8 to 13 |
| How confident can I be about a number? | An interval, not a point | Ch 71 to 75 |
| Is this difference real or is it noise? | A hypothesis test plus an effect size | Ch 76 to 84 |
| How do these things move together? | Correlation, then regression | Ch 92 to 102 |
| Did X cause Y? | A design, not a model | Ch 143, Ch 181 to 184 |
| What will happen to this individual? | A predictive model and honest validation | Ch 108 to 131 |
| What will happen next month? | A forecast with an origin and a horizon | Ch 132 to 141 |
| How long until the event? | Survival analysis, because of censoring | Ch 144, Ch 203 |
| Who is being affected, and unequally? | A fairness audit against the right yardstick | Ch 158, Ch 204 |
The Shape of the Data
Before any statistic, two structural questions decide what is even possible.
What is one row? That is the grain, and getting it wrong invalidates everything downstream. One row per customer, per customer-month, per order, per order-line: these are four different datasets with four different answers to the same question. A count of rows only means something once the grain is named.
What kind of variable is each column? The level of measurement decides which summaries and which tests are legitimate, and it is not the same thing as the storage type. A postal code stored as an integer is nominal, and its mean is meaningless.
| Level | What it supports | Center | Typical test |
|---|---|---|---|
| Nominal | Categories with no order | Mode | Chi-square |
| Ordinal | Order, but unequal gaps | Median | Rank-based tests |
| Interval | Equal gaps, arbitrary zero | Mean | t, ANOVA |
| Ratio | Equal gaps, true zero, so ratios mean something | Mean, geometric mean | t, ANOVA, log models |
Alongside that sit the reshaping questions: long against wide, one table or a join, and what a join does to your row count. A join that changes the row count unexpectedly is a bug until proven otherwise, and checking counts before and after every merge catches a large share of quiet disasters. See Chapters 4 and 5 and Chapter 23.
Cleaning: What Actually Goes Wrong
Across forty-one capstones the same faults kept arriving. This is the catalog, built from what was actually planted and actually found.
| Fault | How to find it | What it costs if missed |
|---|---|---|
| Duplicate rows | duplicated() on the key, not just on the whole row | Every count and mean is wrong, silently and slightly |
| Sentinel codes: -1, 999, 9999 | Look at min, max and the 1st and 99th percentiles of every numeric column | Worse than a blank. It is analyzed as data and nothing warns you |
| Text in a numeric column | Check dtypes. An object column of numbers has a string in it | The whole column is text, and the blank count comes out wrong |
| Category drift: Ops and Operations | Value counts on every categorical, sorted alphabetically | Groups split in two, and a group comparison is quietly wrong |
| A partial final period | Compare the last period to the same period a year earlier | Reads as a collapse, and it sits where the model is most sensitive |
| Decimal slips and unit changes | Ratio to the same period last year. A value 9.9 times its history is a keystroke | One point dominates every statistic in the column |
| Impossible values | Range checks against what the world allows: age 214, negative cost | Distorts the tail, which is often where the decision lives |
| Records out of order | Cross-field logic: exit before hire, delivery before order | Negative durations, and a silent sign error downstream |
| Gaps in a time index | Reindex onto a complete calendar and count what appears | Anything reaching back twelve positions instead of twelve months compares the wrong periods |
| A negative that is really an adjustment | Ask what a negative means in this system before deciding what to do | A refund read as demand of minus eleven units |
first_look and clean_report.
Outliers are a decision, not a cleaning step. A value can be wrong, or rare and real, and those need opposite treatment. The question is never "is this an outlier" but "is this a measurement error, and if not, does my method tolerate it." See Chapter 21.
Describing: The First Look
The first look is not a formality and it is not a table of means. It is the step that tells you which of the later steps are legitimate.
| Property | Measures | When the usual choice misleads |
|---|---|---|
| Center | Mean, median, mode, geometric mean | The mean on skewed or heavy-tailed data describes nobody |
| Spread | SD, variance, IQR, range, MAD, CV | SD understates risk when tails are heavy; use quantiles |
| Position | Percentiles, quartiles, z-scores | A z-score assumes the SD is meaningful, which skew undermines |
| Shape | Skewness, kurtosis | Both are unstable in small samples; look at the histogram too |
| Relationship | Covariance, correlation, cross-tabs | A single correlation hides non-linearity and subgroup reversal |
Compute the summary, then plot the thing. Anscombe's quartet is the classic warning, and every capstone in this book opened with a visual first look for the same reason: the number that would have misled was visible in the picture. Chapters 8 to 13.
Visualizing: Choosing the Picture
| What you are showing | Reach for | Avoid |
|---|---|---|
| One numeric distribution | Histogram, density, box, violin | A bar of the mean, which hides everything |
| Numeric by a few categories | Box or violin side by side, strip plot if n is small | Bar plus error bar, which hides the shape |
| Two numerics | Scatter, with a smoother | A correlation quoted without the plot |
| Category counts | Horizontal bars, sorted by value | Pie charts beyond three slices |
| Part to whole over time | Stacked area, or small multiples | Stacked bars when the reader needs the middle series |
| Change over time | Line, with the origin marked if it is a forecast | Truncated y axes on a line that implies a trend |
| Many variables at once | Small multiples, pair plot, parallel coordinates | A single chart with five encodings |
| Uncertainty | Bands, fans, interval dots | A point estimate on its own |
| A model's errors | Residual plots, calibration curves | Reporting only the headline metric |
The default chart is the one that shows every observation. Summarize only when the count makes that impossible, and then say what was summarized. Chapter 17 is the decision tree, and Chapter 157 is what changes when the audience is not you.
Distributions: The Catalog
A distribution is a claim about the process that generated the data. Choosing one is choosing a story about mechanism, which is why the middle column matters more than the name.
| Distribution | Arises when | Typical use |
|---|---|---|
| Bernoulli | One trial, two outcomes | A single click, a single conversion |
| Binomial | n independent trials, constant probability | Defects per batch, conversions per cohort |
| Poisson | Events in continuous time at a constant rate | Arrivals, faults, claims per period |
| Negative binomial | Counts with more spread than Poisson allows | Overdispersed counts, which is most real count data |
| Geometric | Trials until the first success | Attempts before conversion |
| Hypergeometric | Sampling without replacement from a finite pool | Quality inspection of a shipment |
| Normal | Many small independent additive effects | Measurement error, and sample means via the CLT |
| Log-normal | Many small independent multiplicative effects | Income, cost, session length, price |
| Exponential | Waiting time at a constant hazard | Time between arrivals, memoryless lifetimes |
| Gamma / Weibull | Waiting time with a changing hazard | Lifetimes, failure and survival times |
| Beta | A proportion constrained to zero and one | Rates, and Bayesian priors on probabilities |
| Uniform | Equal density across a range | Simulation, and p-values under the null |
| Student's t | A mean standardized by an estimated SD | Inference on means with unknown variance |
| Chi-square | Sum of squared standard normals | Variance inference, goodness of fit, independence |
| F | Ratio of two scaled chi-squares | ANOVA and comparing nested models |
Two practical habits. When data is positive and right-skewed, try a log scale before trying a more complicated model, because multiplicative processes are extremely common and a log turns them into additive ones. And when counts are overdispersed, move from Poisson to negative binomial rather than pretending the variance assumption held, which is what Chapter 189 was about.
Checking the Data Before Testing It
Every method rests on assumptions, and the assumptions are testable. What follows is the battery, what failure looks like, and what to do about it, which is almost never "abandon the analysis."
| Assumption | How to check | If it fails |
|---|---|---|
| Normality | Q-Q plot first; Shapiro-Wilk or D'Agostino as support | With n above about 30, tests about means are usually fine anyway. Otherwise transform, or use a rank-based test |
| Equal variances | Levene's test, and residuals against fitted | Use Welch's t or Welch's ANOVA, which cost almost nothing and assume less |
| Homoscedasticity in regression | Breusch-Pagan, scale-location plot | Robust standard errors. The coefficients are fine; the standard errors were not |
| Linearity | Residuals against fitted, partial residual plots, RESET | Add a term, transform a variable, or use a spline. Fix this before the other checks |
| Independence | Durbin-Watson, ACF, and knowing how the data was collected | Cluster-robust errors, mixed models, or a time series method |
| Multicollinearity | VIF, correlation matrix, condition number | It harms interpretation, not prediction. Drop, combine, or regularize |
| Influence | Cook's distance, leverage, DFBETA | Investigate the point. Refit without it and report both if it matters |
| Expected counts | The smallest expected cell in a chi-square table | Below 5, use Fisher's exact test |
| Proportional hazards | Schoenfeld residuals against time | Split follow-up, stratify, or fit a time-varying coefficient |
| Missingness mechanism | Compare observed variables across missing and present | MAR is untestable. Use multiple imputation and a sensitivity analysis |
And a warning about normality tests specifically. With a large sample they reject departures too small to care about; with a small one they miss departures that matter. They answer "is this exactly normal," which is never the question. The Q-Q plot answers "is this normal enough for what I am about to do," which is.
Sampling and Study Design
Everything downstream inherits whatever the collection did. No model repairs a sample that never contained the people the conclusion is about.
| Scheme | How it works | What it buys, and costs |
|---|---|---|
| Simple random | Every unit equally likely | The baseline. Often impractical and rarely the most efficient |
| Stratified | Split into strata, sample within each | More precision for the same n when strata differ. Needs weights on the way out |
| Cluster | Sample groups, measure everyone inside | Much cheaper, and less precise than n suggests. Correct with the design effect |
| Systematic | Every k-th unit from a list | Easy, and dangerous if the list has a period matching k |
| Multistage | Clusters, then units within them | How most large surveys actually run. Variance is not textbook |
| Convenience / opt-in | Whoever responds | Cheapest, and the selection is unknowable. Weighting helps and does not fix it |
Then the design hierarchy, which decides what kind of claim is available at the end.
| Design | What it supports | The main threat |
|---|---|---|
| Randomized experiment | Causal claims about the average effect | Non-compliance, attrition, and peeking at the results |
| Regression discontinuity | Causal, local to the cutoff | Manipulation of the running variable |
| Instrumental variables | Causal, for the compliers | Weak or invalid instruments, which are hard to detect |
| Difference in differences | Causal under parallel trends | Parallel trends is an assumption, not a finding |
| Matching / propensity | Causal only if all confounders are observed | The confounder you did not measure |
| Plain observational regression | Association, adjusted | Everything above, plus collider bias from bad controls |
Sample size is a decision made before collection, not a justification made after. Power depends on the effect size you would not want to miss, the variability, the significance level and the power you want. Running the calculation after a null result to explain it is a well-known way to say nothing. Chapter 65, and Chapter 181 for what sequential peeking does to the error rate.
Estimation and Uncertainty
A point estimate without an interval is an opinion with decimal places.
| Interval | Answers | Width driven by |
|---|---|---|
| Confidence interval | Where the population parameter plausibly sits | Standard error, which shrinks with the square root of n |
| Prediction interval | Where the next individual observation will fall | Standard error plus the residual spread. Always much wider |
| Tolerance interval | Where a stated proportion of the population sits | Both, plus the coverage you demand |
| Credible interval | Where the parameter is, given prior and data | The posterior, and therefore the prior as well |
| Bootstrap interval | Any of the above, without a formula | Resampling variability, and the assumption that your sample resembles the population |
Confusing the first two is one of the most common errors in applied work. A 95 percent confidence interval for a mean says nothing about where an individual will land, and quoting it to someone who needs to plan for individuals will systematically understate their risk.
The bootstrap is the general-purpose escape hatch. When the formula does not exist, the assumptions do not hold, or the statistic is something odd like a ratio of medians, resample and look at the spread. Chapter 75.
Hypothesis Testing: Which Test, and When
The test follows from four things: what kind of outcome, how many groups, whether observations are paired, and whether the distributional assumptions hold.
| Situation | Test | Effect size to report with it |
|---|---|---|
| One mean against a value | One-sample t | Cohen's d, and the raw difference |
| Two independent means | Welch's t | Cohen's d, difference with CI |
| Two paired measurements | Paired t on the differences | Mean difference with CI |
| Three or more means | One-way ANOVA, then Tukey | Eta-squared or omega-squared |
| Two factors at once | Two-way ANOVA | Partial eta-squared per effect and interaction |
| Repeated measures on the same units | Repeated-measures ANOVA or a mixed model | Effect size plus the within-unit correlation |
| Two proportions | Two-proportion z, or chi-square | Risk difference, relative risk, odds ratio |
| Independence in a table | Chi-square, Fisher if sparse | Cramer's V |
| Two variances | Levene's test | Ratio of variances |
| Linear association | Pearson r | r and r-squared with CI |
| Monotone association, or outliers present | Spearman rho, Kendall tau | The coefficient itself |
| Ordinal outcome across groups | Mann-Whitney or Kruskal-Wallis | Rank-biserial correlation, epsilon-squared |
| Time to an event | Log-rank, then Cox | Hazard ratio with CI |
Discipline that applies to every test on that list
- State the hypothesis before seeing the data. A hypothesis formed after looking at the result is a description, and its p-value means nothing.
- A p-value is not the probability the hypothesis is true, and it is not an effect size. It is the probability of data at least this extreme if the null were true, and with enough n everything is significant.
- Report the effect size and its interval. If the interval spans values that would lead to different decisions, the honest conclusion is that the study did not settle it.
- Correct for multiplicity when you run many tests: Bonferroni when there are few and they matter, Benjamini-Hochberg when there are many and you can tolerate some false discoveries. Chapter 163 shows what happens without it.
- Not significant does not mean no effect. It means this study could not distinguish the effect from zero, which is a statement about the study as much as about the world.
Association and Regression
Correlation asks whether two things move together. Regression asks by how much, holding other things fixed, and that phrase is where all the difficulty lives.
| Outcome | Model | What the coefficient means |
|---|---|---|
| Continuous, roughly symmetric | Linear regression (OLS) | Change in y per unit of x |
| Continuous, positive and skewed | Log-linear, or a gamma GLM | Approximate percentage change in y |
| Binary | Logistic regression | Log-odds; exponentiate for an odds ratio |
| Count | Poisson, or negative binomial if overdispersed | Log rate; exponentiate for a rate ratio |
| Count with varying exposure | Poisson with an offset | The offset decides whether you model counts or rates |
| Proportion or rate bounded 0 to 1 | Beta regression, or binomial GLM | Effect on the transformed scale |
| Ordered categories | Ordinal logistic | Proportional odds across thresholds |
| Time to event with censoring | Cox proportional hazards | Multiplier on the hazard rate |
| Many correlated predictors | Ridge, lasso, elastic net | Shrunk, and biased on purpose for stability |
| Grouped or repeated observations | Mixed model, or cluster-robust errors | Fixed effects plus explicit group variation |
R-squared is not a measure of correctness. It measures variance explained in the sample, it never decreases when you add a variable, and a high value on a misspecified model is common. Adjusted R-squared, AIC and out-of-sample error are all better, and the residual plots are better than any of them. Chapters 95 to 102.
Machine Learning
The methods change; the discipline does not. Almost every machine learning failure in this book was a validation failure rather than a modeling one.
| Task | Start with | Then try | Judge on |
|---|---|---|---|
| Binary classification | Logistic regression | Gradient boosting, random forest | PR AUC and calibration, not accuracy |
| Multi-class | Multinomial logistic | Boosting, neural nets if the data is large | Macro F1, per-class confusion |
| Regression | Linear, then regularized | Gradient boosting | MAE or RMSE, and residual plots |
| Ranking | Logistic scores | Learning to rank | NDCG, precision at k |
| Clustering | k-means with scaled features | Hierarchical, DBSCAN, GMM | Silhouette, stability, and whether the clusters mean anything |
| Dimensionality reduction | PCA | UMAP or t-SNE for visualization only | Variance retained, and downstream performance |
| Anomaly detection | Robust z-scores, IQR rules | Isolation forest, autoencoders | Precision at the alert volume you can action |
| Recommendation | Popularity baseline | Matrix factorization, hybrids | Ranking metrics, coverage, and cold start |
| Text | TF-IDF plus linear | Transformers, fine-tuning | Task metric, and a held-out set of real examples |
The rules that mattered more than the algorithm
- Split before you touch anything. Scaling, imputation and encoding all learn from the data and all leak if they are fitted before the split. Fit inside the pipeline, inside the fold.
- Beat a baseline that costs nothing. The majority class, the previous value, the overall mean. If the model cannot beat it, the model is not the finding.
- Accuracy on imbalanced data is a trap. At a 3 percent base rate, predicting "no" scores 97 percent. Read the base rate first, then PR AUC.
- Calibration is a separate property from ranking. A model with excellent AUC can produce probabilities that mean nothing, which matters the moment a threshold or a cost is attached (Chapter 188).
- Tuning on the test set spends it. Data used to choose can no longer measure. Use nested validation, or seal a set and open it once.
- Explain the model before deploying it with SHAP or permutation importance, and treat a feature that is suspiciously predictive as a leak until proven otherwise (Chapter 117).
Time Series
Time changes three things: the observations are not independent, the order is information, and validation has to respect the arrow of time.
| Situation | Method | Note |
|---|---|---|
| A baseline to beat | Naive, seasonal naive, drift | Harder to beat than expected. Keep them in the comparison permanently |
| Trend and seasonality, no exogenous drivers | Exponential smoothing (ETS) | Fast, robust, and often the winner |
| Autocorrelation structure matters | ARIMA, SARIMA | Difference to stationarity first, and check with ADF or KPSS |
| Multiple related series | VAR, or hierarchical reconciliation | Forecasts that must add up need reconciling |
| Volatility is the quantity of interest | ARCH, GARCH | The mean model and the variance model are separate |
| Mostly zeros | Croston, SBA, or a quantile target | Percentage errors are undefined; the metric's optimum may be zero |
| Many series, shared patterns | Global models, gradient boosting on lags | Requires careful feature construction to avoid leakage |
The four rules that apply whatever the model is
- Never shuffle. Random k-fold on a time series trains on the future and reports an accuracy nobody will ever see again.
- Respect the origin. Every forecast must use only what was genuinely available at the moment it is made, including any feature that was revised later.
- Score at the horizon the decision needs. A one-step-ahead error is irrelevant to a twelve-month plan.
- Use many origins. One holdout is one draw, and the spread across origins is usually more informative than the average (Chapter 201).
And check that the interval covers. Forecast uncertainty usually grows with the horizon, so a band of constant width is over-confident about the far end. Measuring empirical coverage per horizon takes a few lines and is almost never done.
Specialized Situations and Their Tells
Some problems look like ordinary ones and are not. Recognizing the tell is most of the work.
| The tell | What it actually is | The right tool |
|---|---|---|
| Rows with gaps, and dropping them loses half the data | A missing-data problem with a mechanism | Multiple imputation, plus sensitivity if the mechanism may be MNAR (Ch 202) |
| The event has not happened yet for most units | Censoring, which is not missingness | Kaplan-Meier and Cox (Ch 203) |
| Two events compete for the same unit | Competing risks | Cause-specific hazards or Fine and Gray |
| Observations arrive in groups | Clustering, so the effective sample is smaller | Mixed models, cluster-robust errors, design effects |
| The outcome is a proxy for what you care about | Label bias | Audit against the target quantity, not the label (Ch 204) |
| Treatment was not assigned at random | Confounding | A design: RDD, IV, difference in differences, matching |
| You have real prior information | A Bayesian problem | Priors, posteriors, credible intervals (Ch 142) |
| Constructs measured by several imperfect items | Latent variables | Factor analysis, SEM (Ch 145) |
| Positives are 0.1 percent of the data | Extreme imbalance | PR curves, resampling, cost-sensitive thresholds, anomaly methods |
| The data does not fit in memory | An engineering problem before a statistical one | Sampling, chunking, columnar formats, distributed compute (Ch 149) |
Communicating, Shipping and Watching
An analysis nobody acts on and a model nobody monitors are the same failure at different points in the pipeline.
Writing the result
- Lead with the decision, not the method. The first sentence should be what to do and why, and the method belongs where the people who need it will look for it.
- Put the uncertainty in the headline. A range in the summary and a point estimate in the appendix is the wrong way round.
- Write the falsifier down. What would change this conclusion is the most useful paragraph in any report and the one most often missing.
- Two documents, not one. A plain-language brief for the decision and a technical report for the method. Every capstone in this book shipped both, because they have different readers and merging them serves neither.
Making it survive
- Version control everything, including the analysis. A result that cannot be regenerated is an anecdote (Chapter 156).
- Pin the environment. A notebook that ran last year and does not run today is a dependency problem, and it is usually discovered at the worst moment.
- Separate the pipeline from the exploration. Notebooks are for thinking; modules and scripts are for anything that runs twice.
- Monitor the inputs, not just the outputs. Data drift arrives before performance drops, and by the time the metric moves the damage is done (Chapter 150).
- Keep the free baseline running in production. The day the maintained model stops beating it is the day something broke, and that is the cheapest alarm you will ever build.
The Mistakes That Kept Recurring
Across forty-one capstones the same handful of errors did nearly all the damage. They are worth naming because none of them are exotic, and every one produced a confident, plausible, wrong answer.
Reading those twelve together, only two are about choosing the wrong method. The rest are about measuring the wrong thing, measuring it on the wrong data, or believing a number that was never checked. That ratio has been the most useful thing in the book to know.
What This Book Did Not Cover
Being explicit about the edges is more useful than a summary that implies completeness.
Mathematical depth. The advanced part covers moments, MGFs and conditional expectation, but this is an applied book. Proofs of the theorems being used, measure-theoretic probability and the asymptotic theory behind the estimators are all somewhere else, and eventually worth going to.
Experimental design as a discipline. Factorial designs appear once. Response surface methods, optimal design, blocking beyond the basics and sequential designs are a field of their own.
Deep learning in earnest. There is a primer and an application chapter. Training modern architectures, distributed training, and the practical craft of it are a different book.
Data engineering. Pipelines, orchestration, streaming, warehouse modeling and cost control decide whether analysis is possible at all, and they get one chapter here.
Domain knowledge. The largest gap by far. Every method in this book is worth less than knowing what a plausible value looks like in your field, and that cannot be transferred by a textbook.
Where to Go From Here
Four routes. They are not exclusive and most careers are a mixture, but the first choice worth making is which one you are deliberately deepening this year.
The applied statistician
Design, causal inference, mixed and hierarchical models, Bayesian methods. Learn R properly. Read Gelman and Hill. Go deeper into Chapter 143 and the design capstones.
The machine learning engineer
Software engineering first, then deep learning and MLOps. Serving, monitoring, feature stores, testing. The gap for most analysts is engineering, not modeling.
The analytics leader
Experimentation platforms, metric design, decision frameworks, and communication. The scarce skill is turning an ambiguous business question into an estimand.
The researcher
Mathematical statistics, the literature in a specific area, and writing. Reproducibility and pre-registration matter more here than anywhere else.
The next five things to learn, in a defensible order
- 1. SQL, to a level you would not describe as basic. Window functions, CTEs, query plans. More analysis time is spent getting data than analyzing it, and this is the largest single multiplier on your speed (Chapter 154).
- 2. Causal inference, properly. DAGs, potential outcomes, and the identification strategies. It is the difference between describing and explaining, and most business questions are causal whether or not anyone says so.
- 3. Software engineering habits. Version control, tests, packaging, code review. Not to become an engineer, but because analysis that cannot be rerun is analysis that has to be redone.
- 4. Bayesian methods. Not as an ideology but as a second toolkit, particularly for small samples, hierarchical structure and genuine prior information.
- 5. One domain, deeply. Finance, health, marketing, operations, policy. Generic skill plus domain knowledge beats more generic skill, and it compounds.
How to practice, in descending order of value
- Analyze data you care about and nobody has cleaned. Your own spending, your team's tickets, a public dataset on something you follow. The mess is the education, and the caring is what makes you check the answer.
- Redo an analysis someone published and try to break it. Reproducing a result and testing its sensitivity teaches more than a new tutorial, and it builds exactly the reflex this book has been arguing for.
- Write it up for a reader who will push back. Nothing exposes a weak analysis faster than having to defend it in writing to someone with a stake in the answer.
- Compete, but read the winners. Kaggle teaches modeling and validation and teaches nothing about problem definition or data collection. The write-ups are worth more than the leaderboard.
- Teach one thing. A blog post, an internal talk, a colleague. The chapters in this book that were hardest to write are the ones I understood least well going in, which is the general case.
A ninety-day plan, if you want one
- Weeks 1 to 2. Take the toolkit notebook below, put it in a repository of your own, and use it on a dataset from your work. Fix what does not fit your data.
- Weeks 3 to 6. Run one complete project end to end on messy data you sourced yourself: question, collection, cleaning, analysis, validation, and both write-ups. Not a tutorial dataset.
- Weeks 7 to 10. Pick the largest gap from the five above and work only on it. Deliberate practice on one weakness beats broad review.
- Weeks 11 to 12. Go back to a piece of work you did before reading this book and audit it. Find what you would now do differently and write that down. That document is the most honest measure of what changed.
For statistics: Gelman and Hill on regression and hierarchical models, Gelman et al. on Bayesian data analysis, and Efron and Hastie for how the modern methods relate to the classical ones. For causal work: Pearl's Book of Why to build the intuition, then Hernan and Robins for rigor, with Angrist and Pischke for the econometric tradition. For machine learning: Hastie, Tibshirani and Friedman remains the reference, with Murphy for the probabilistic view. For forecasting, Hyndman and Athanasopoulos is free online and excellent. For communication, Tufte and Cairo. And for the habits rather than the mathematics, Vanderplas on Python and Wickham on R and tidy data.
A note on staying current. The methods in the first two thirds of this book have been stable for decades and will outlast anything you learn this year about a specific library. The tooling changes constantly and matters less than it appears to. Spend your attention accordingly: read papers and textbooks for the ideas, and documentation for the tools, and do not confuse the two.
The One Thing
If a single habit had to survive from two hundred and four chapters, it is this: check the thing you are about to believe.
Not the assumption you were taught to check, though those matter. The number itself. Does the interval cover at the rate it claims? Was this data used to choose the thing it is now judging? Is this metric computable on the data it is being computed on? Would this conclusion survive the one obvious objection?
Almost every failure collected in this book would have been caught by someone spending twenty minutes trying to break their own result before presenting it. That is not a statistical technique. It is a habit, and it is the one worth keeping.
What the book was for
- Chapters 1 to 30 were about the data itself: what kind of thing it is, what it looks like, and what is wrong with it. Most projects fail here.
- Chapters 31 to 91 were about uncertainty: where it comes from, how to quantify it, and what can honestly be concluded from a sample.
- Chapters 92 to 141 were about relationships and prediction: regression, machine learning, forecasting, and the validation each of them needs.
- Chapters 142 to 158 were about the harder cases and the consequences: advanced methods, the tools, communication and ethics.
- Chapters 159 to 204 were forty-one complete projects on deliberately broken data, because knowing the method and finishing the project are different skills.
Every capstone here planted its faults on purpose and then found them, which is a luxury real work does not offer. The point of doing it forty-one times was never the individual answers. It was to make finding them automatic.
The analyst's toolkit, to keep
The companion notebook is not a worked example. It is nine reusable functions that do the things
every project needs doing: first_look for the ten minutes before anything else,
clean_report so every repair is printed, describe_plus which warns when the
mean is not a fair summary, check_distribution and check_model for the
assumption batteries, choose_test which prints its reasoning,
evaluate_classifier including calibration and group disparity,
rolling_backtest for forecasts, and a project checklist. Written plainly, with no
classes and no configuration, so they can be lifted straight into a module of your own.
This chapter links out to the rest of the book rather than shipping a dataset of its own. The full contents lists all 205 chapters, and every capstone from Chapter 159 onward ships its own messy dataset, notebook, plain-language brief and technical report. Those datasets are the best practice material here, because the faults in them are known and findable.
🎓 Key Takeaways
- ✓The pipeline is a loop, not a line. Cleaning sends you back to collection, describing sends you back to cleaning, and a plan with no backward arrows in it has not met any data yet.
- ✓The question comes before the data. A decision, an estimand with units, a threshold that matters, and a result that would change your mind. Written down before the file is opened.
- ✓Method follows from four properties. The type of outcome, the number of groups, whether observations are paired, and whether the assumptions hold. Every test table in this chapter is that same decision in a different domain.
- ✓Assumptions are checkable and failures are signposts. Non-constant variance means use robust errors, not abandon the model. Fix linearity first, because one missing curve shows up as three separate failures.
- ✓Of the twelve recurring mistakes, only two were choosing the wrong method. The rest were measuring the wrong thing, measuring it on the wrong data, or believing a number nobody checked.
- ✓Coverage is the property almost nobody measures. Nominal 95 percent intervals in this book delivered 67.9 percent and 2.7 percent, and both were found with a few lines of code.
- ✓Next: SQL properly, causal inference properly, engineering habits, Bayesian methods, and one domain deeply. In that order, and the last one compounds fastest.