Open Family Office Datasets Tickers Strategies Portfolios Research Posts About Changelog

Best Practices in Data Cleaning

Source

Citation. Jason W. Osborne (Old Dominion University). Best Practices in Data Cleaning: A Complete Guide to Everything You Need to Do Before and After Collecting Your Data. SAGE Publications, Thousand Oaks, CA, 2013. ISBN 978-1-4129-8801-8 (paperback). 13 chapters in three sections, for researchers in the social and behavioural sciences. Its examples are surveys and education data sets, such as NELS-88 and ELS 2002.

Status. Planned. The repo already avoids the book's look-ahead traps: it imputes nothing, and it flags suspect moves for a person to check, not to remove. The book's demand that every cleaning step be reported has no counterpart for a series yet. #441 would add a point-in-time data-quality report for each series.

Read. Read on 2026-11-28 from a PDF of the book that the maintainer supplied, 293 pages with a text layer. Two subagents read chapters 1, 5, 6, 7, 8, 12 and 13 in full. Those are about why cleaning matters, screening, missing data, extreme points, Box–Cox, repeated measures and the summary. I checked the quotes and the numbers below against the text. Not read: chapters 2–4 (power and sampling), 9 (reliability), 10 (careless responding) and 11 (dichotomising). The figures came out as axis labels only, so no number here comes from a figure.

Summary

Claim. "robustness is largely a myth in modern statistical analysis". Data that break a method's assumptions can bias its estimates without any sign, so every analysis should clean its data, and report what it did.

Method. Each chapter takes one problem, sets out the choices, and tests them on large survey data, treated as the population.

Findings, as the book reports them.

Setting Result Where
Missing math scores, removed at random listwise deletion r = .77, mean substitution .69 Table 6.1
The same, removed mostly in both tails deletion .61, mean substitution .38, strong regression imputation .73 Table 6.1
The same, removed to reverse the relation deletion r = −.20, mean substitution −.06. Multiple imputation, 20 imputations, 0.51 Tables 6.1, 6.3
Mean substitution, at random the standard deviation understated by 10.47% Ch. 6
Correlation, ρ = .46, N = 52, 4% extremes wrong inferences fall from 53% of samples to 0% once the extremes are removed Table 7.1
Faculty size and salary, after Box–Cox r from .49 to .66, "81.50% increase in the coefficient of determination" Ch. 8
Repeated measures, only one of four times transformed F(3, 297) = 2476.24 from random data with equal means. All four transformed alike, F < 1 Ch. 12

Where the claims go beyond the evidence

The outlier simulation is circular. The "extreme" cases are those beyond three standard deviations, and the "population" is the data without them. Removing the extremes then returns each sample to that population by construction. The simulation can't show what happens when the extremes are the signal.

The advice removes true extremes too. For an extreme that belongs to the population, "Judd and McClelland (1989) suggest removal of the extreme data points, and I concur". Events like a hurricane "should be discarded as they do not represent the normal processes you wish to study". That fits a survey of normal conditions. It doesn't fit returns, where the rare event is the risk.

Each result is one draw. The missing-data and Box–Cox results are single simulated samples, with no replications and no error. The Box–Cox gain in r² was found on the data that chose λ.

Cleaning after seeing the data isn't treated as a bias. The author says that after screening, "I may examine the data more closely and modify the extreme score detection strategy accordingly". His own story says removing a few points "led to strong support for my original hypotheses". He doesn't discuss either as a fork in the analysis.

Nothing on time series. The book has no treatment of time order, look-ahead or autocorrelation. Its best imputation fills a 10th-grade score from the same student's 12th-grade score: in a backtest, that is look-ahead.

Credit. The author separates causes clearly: "not all extreme scores are illegitimate contaminants, and not all illegitimate scores show up as extreme scores". He says "There is information in missingness", and advises a dummy variable for it. He asks every study to "both perform and report the results of data cleaning", even when the data stay the same. Chapter 12's rule is to "treat all time points equally", and its simulation shows what breaking that rule fabricates.

Use in this repo

The repo imputes nothing, which avoids the book's look-ahead. The harness trades only at the times when every ticker has a close (harness.market). A missing value is left out: FRED's "." and French's −99.99 never become numbers (fetchers.py). Every method that the book prefers, regression imputation and multiple imputation, fits on the whole sample. A backtest must not use them. A gap stays a gap.

Missing isn't random in markets. The book shows that deletion biases a result when the gaps depend on the values. A stock's prices stop because it was delisted, often after it failed. That is survivorship, which survivorship: biased already flags as a warning on each evaluation (registry/datasets/, #231, #85). A suspension of trading or a stale feed is a gap of the same kind.

An extreme return is not a contaminant. The book's causes carry over, but its default doesn't. A bad tick or a missed split is a data error, and should be corrected from the source or flagged. actions.suspect_splits flags such moves for a person, and removes nothing. A crash is a true extreme, and removing it would hide the risk that matters most (#151). A three-standard-deviation rule set on the whole sample is also look-ahead.

A transform's parameter is a choice on the data. Box–Cox chooses λ for the most normal shape, on the whole variable. For a strategy's feature, λ must be chosen on past data only. Each λ tried is a trial in the ledger (trials.py, #7). The verdict judges returns as they are, so it uses no transform.

Every cleaning choice is a fork. The book's own new rule after screening is the forking path that forking-paths.md measures as a "hacking interval". A cleaning rule chosen after the results counts as trials, like a parameter. Chapter 12's rule carries over: the same cleaning for every time and every ticker.

Report what was cleaned. The store already keeps every value and every revision with its time (store.py), and each pull's status (pulls.jsonl). What it doesn't give is a report, for one series as of one time, of its gaps, stale runs, suspect moves and revisions. #441 asks for that report, point-in-time and beside the survivorship warning.