OpenEconometrics

Exploratory data analysis: what to check before fitting a model

Exploratory data analysis checks a dataset's structure, missing values and unusual observations. Follow a practical checklist before choosing a model.

By OpenEconometrics · Basics · · 3 min read

Exploratory data analysis, or EDA, is the process of investigating a dataset before committing to a statistical model. You examine what each row represents, how values are distributed, which observations are missing and which patterns deserve a closer look. The aim is to understand the evidence you actually have.

NIST describes EDA as an approach to learning from data, with graphics playing a central role. A histogram is one tool; deciding what its shape means for your question is the analysis.

Start with the unit of observation

Before calculating anything, finish this sentence: “One row is one ___.” It might be a worker, a worker-year, a transaction or a country-month. This determines which counts, joins and comparisons make sense.

Imagine a hypothetical survey of 100 households. An address can contain more than one household, and a household can contain several people. Joining household spending to a person-level file without checking these relationships can repeat the same spending value several times. A tidy-looking table can therefore represent the wrong population.

Write down the intended identifier, reference period and measurement unit for every variable. Check whether an income column contains monthly or annual amounts and whether money is nominal or adjusted for inflation. These choices belong in the analysis record.

Inspect distributions and relationships

Start with a few views that answer specific questions:

QuestionUseful first viewWhat to investigate
How are values spread?Histogram and quantilesSkewness, piles at zero, impossible values
Do groups differ?Group counts and box plotsDifferent distributions and unequal sample sizes
Do two variables move together?Scatter plotCurvature, separate groups, unusual observations
Does the pattern change over time?Time plotGaps, jumps, trends and repeated seasonal patterns

A strong pattern suggests a question; it does not settle an explanation. A spending-income association might reflect household size, age or how the survey was collected. Follow up with correlation versus causation before giving that association a causal interpretation.

Make missing values visible

In the hypothetical survey, suppose 80 households report income and 20 leave it blank. The missing share is 20%, and the mean calculated from the income column describes the 80 respondents. Whether it represents all 100 households depends on why the other 20 did not respond.

If higher-income households are less willing to answer, deleting blanks can change the picture systematically. Filling blanks with the observed mean gives 20 households an invented identical income and conceals uncertainty. Neither action is a neutral default.

Count missing values by variable, group and period. Distinguish “not collected”, “not applicable” and “refused” when the source allows it. Rubin's work on missing data explains why valid inference depends on assumptions about the process producing the missingness. EDA can reveal warning signs; it cannot prove those assumptions from observed values alone.

Investigate outliers before changing them

An extreme value may be a typing error, a unit mismatch or a real observation. NIST's outlier guidance distinguishes flagging a value for investigation from deciding how to analyse it.

Suppose five hypothetical monthly spending values are 100, 110, 120, 130 and 1,040. Their mean is 300; their median is 120. Replacing the last value with 140 would make both 120, but that replacement needs evidence. Perhaps 1,040 includes a genuine annual insurance payment. Perhaps it is a misplaced decimal. Check the source before choosing.

Keep the original value and document any correction. When an unusual observation is genuine, a sensitivity analysis can show how much the conclusion depends on it. Removing it solely because the result becomes more convenient is not a defensible rule.

Separate exploration from confirmation

Exploration can generate hypotheses you did not start with. Record that sequence. A relationship noticed after inspecting many subgroups should not be presented as a prediction specified before seeing the data.

A useful EDA handoff contains the data dictionary, inclusion rules, missingness summary, key plots and unresolved questions. Another analyst should be able to understand why the eventual model uses this sample rather than a slightly different one. The reproducible workflow guide shows how to keep those decisions with the analysis.

References

Try it on your own data

OpenEconometrics is free and open source under Apache 2.0. Install the Python library or download the desktop alpha.

Download Desktop App pip install openecon