Exploratory Data Analysis

Before you model, before you test a single hypothesis, you should look at the data — really look, plot by plot, until it has told you what it is. This discipline of listening to data has a name and a patron saint. In 1977 John Tukey published Exploratory Data Analysis and argued that statistics had grown lopsided: obsessed with confirming pre-formed hypotheses, and neglecting the earlier, humbler art of finding out what questions the data can even answer. EDA is that art.

Tukey's own line captures the spirit: "The greatest value of a picture is when it forces us to notice what we never expected to see." EDA is not a step you rush past to reach the "real" modelling — done well, it is where most of the discoveries actually happen.

Explore, don't confirm

The mindset is the whole point. In confirmatory analysis you decide on a hypothesis, collect data, and run a test that can only say yes or no. In exploratory analysis you arrive with open eyes, let the data suggest hypotheses, and postpone judgement. The two are partners, but they must not be confused — testing a hypothesis on the same data that suggested it is a cardinal sin (we return to it in the "watch out" below).

A practical EDA works outward in three widening circles:

LevelQuestionTypical tools
UnivariateWhat does each variable look like on its own? Centre, spread, shape, skew, gaps, outliers?Histogram, box plot, five-number summary
BivariateHow do two variables move together?Scatter plot, correlation, grouped box plots
MultivariateWhat patterns emerge across many variables at once?Scatter-plot matrix, correlation heatmap, colour/facet encodings

At the univariate stage a histogram reveals the shape of one variable and a box plot flags its outliers at a glance; only then do you start pairing variables up.

Why summary numbers are not enough

Here is the single most important lesson in all of EDA, drawn as a picture. Both clouds of points below have — to two decimal places — the same mean of x, same mean of y, same variances, same correlation, and the same fitted regression line \hat{y} = 3 + 0.5x. Yet one is a genuine straight-line relationship and the other is a perfect curve that a line badly misrepresents:

If you had trusted the summary statistics — or the regression coefficients — you would never have known that the second dataset is not linear at all. Only the plot tells you. This is the heart of EDA: numbers can agree while realities differ wildly.

What you are hunting for

A good exploratory pass systematically checks for the things that break models and mislead readers:

Each finding either fixes a data problem or seeds a hypothesis to test later, on fresh data.

In 1973 the statistician Francis Anscombe built four small datasets — now called Anscombe's quartet — that share, to two decimals, the same mean and variance of x and y, the same correlation of 0.816, and the same regression line y = 3 + 0.5x. On a summary table they are indistinguishable. Plotted, they could hardly be more different: one is a clean line, one a smooth curve, one a perfect line dragged askew by a single outlier, and one a vertical stack rescued by one lone high-leverage point. Anscombe's point, made decades before it was fashionable, was blunt: always plot your data. The modern sequel, the "Datasaurus Dozen," pushes it further — a set of datasets with identical statistics that literally draw a dinosaur. Summary numbers are a compression, and compression loses things.

EDA is gloriously permissive — slice, plot, and hunt for patterns to your heart's content. But the moment you find something, you must not turn around and run a significance test for it on the same data. With enough plots you are guaranteed to stumble on striking patterns by pure chance (the "garden of forking paths"), and a p-value computed after the fact is meaningless — you have already used up the data's surprise. This is the difference between exploratory and confirmatory work. Explore freely, form your hypothesis, then confirm it on a held-out or freshly collected sample. Reporting an EDA-discovered pattern with a confirmatory p-value is one of the most common ways honest analysts fool themselves.

Learn this on Kaggle

Kaggle Learn's free Data Visualization course is an EDA workshop in disguise: you build the histograms, scatter plots and heatmaps of this lesson on real datasets and learn to read what they are telling you before a single model is fit.