Search topics and sections

Data analysis is the process of turning raw data into useful information. A typical analysis has these steps:

  1. Set a question.
  2. Gather data.
  3. Clean and reshape the data.
  4. Summarize it with numbers and graphs.
  5. Build models, which are simplified mathematical or computational descriptions of the data, to help answer the question.
  6. Share the results so others can use them.

Data analysis is used in almost every field, from science and medicine to business and government. It is a core part of statistics, data science, and analytics.

Statistician John Tukey helped define data analysis as a field of its own in 1962.[1]

What counts as data analysis

Tukey gave a broad definition in his 1962 paper "The Future of Data Analysis".[1] He included:

  • procedures for analyzing data
  • techniques for interpreting the results of those procedures
  • ways of planning how data are gathered, so the analysis is easier, more precise, or more accurate
  • all the methods and results of mathematical statistics that apply to analyzing data

The same paper states what Tukey called the most important rule for data analysis: "Far better an approximate answer to the right question, which is often vague, than an exact answer to the wrong question, which can always be made precise."[1]

The question still comes first. Jeffery Leek and Roger Peng found that the most frequent failure in data analysis is mistaking the type of question being asked.[2]

The section Six types of questions lists those types.

The steps of an analysis

Most analyses follow the same broad steps. The textbook R for Data Science describes the tools in the order an analyst uses them, starting once the question is set.[3][2] In its terms, a variable is a measured feature (such as height) and an observation is one recorded case (such as one person).

  1. Import. Load the data from a file, database, or web service into the analysis software.
  2. Tidy. Store the data in a consistent form, with each column a variable and each row an observation.
  3. Transform. Pick out the observations of interest, compute new variables from old ones, and calculate summary numbers such as counts or means.
  4. Visualize. Draw graphs that can show unexpected patterns or suggest that the question or the data need to change.
  5. Model. Use mathematical or computational tools to answer questions once they are precise.
  6. Communicate. Share the results so others can understand and use them.

Tidying and transforming together are called data wrangling.[3]

Steps 3 to 5 repeat many times, because graphs and models have strengths that complement each other.[3]

Tool Strength Limitation
Graph Can show things the analyst did not expect Needs a person to read it, so it does not scale well
Model Scales well to large amounts of data Cannot question its own assumptions
Steps of a data analysis Question Import Tidy Transform Visualize Model Communicate Understand refine the question Wrangle
The steps of a data analysis, after the model in R for Data Science. A question leads to importing and tidying data. Transforming, visualizing, and modeling repeat in a loop to build understanding, and the results are communicated.

CRISP-DM

In business, a common process model is the Cross-industry standard process for data mining (CRISP-DM). Its 1.0 guide, published by an industry group in 2000, splits a project into six phases.[4]

  1. Business understanding. Learn what the customer wants to achieve and turn it into goals for the analysis.
  2. Data understanding. Collect the first data, describe and explore it, and check its quality.
  3. Data preparation. Select, clean, build, combine, and format the data that the models will use.
  4. Modeling. Choose and apply modeling methods and tune their settings.
  5. Evaluation. Check whether the models meet the business goals and decide what to do next.
  6. Deployment. Put the results to use, which can be as simple as a report or as complex as a repeatable process across a company.

The guide says the order of the phases is not fixed and that moving back and forth between them is always needed.[4] For example, modeling often sends the analyst back to data preparation.[4]

CRISP-DM cycle1 Businessunderstanding2 Dataunderstanding3 Datapreparation4 Modeling5 Evaluation6 DeploymentDataiterate
The six CRISP-DM phases run clockwise around a central data store, from business understanding to deployment. Modeling can loop back to data preparation, and evaluation can send the project back to business understanding.

Preparing the data

Raw data are rarely ready to analyze. The paper that defined tidy data opens by noting that "a huge amount of effort is spent cleaning data to get it ready for analysis".[5]

Tidy data

Tidy data is a standard layout for a data table, set out by Hadley Wickham in 2014.[5] It has three rules:

  • each variable is a column
  • each observation is a row
  • each type of observational unit is a table

An observational unit is the kind of thing being recorded, such as a person or an event. This layout lets a small set of tools handle a wide range of messy data sets.[5]

Messy and tidy versions of the same tableMessyTidytidycountry19992000A120150B300340years stored as column namescountryyearcasesA1999120A2000150B1999300B2000340each column is a variableeach row is an observationeach cell is a valueillustrative values
The same case counts in a messy table, where the years are column names, and in a tidy table, where each column is a variable and each row is one observation of country, year and cases. The values are illustrative.

Cleaning

Data cleaning finds and fixes problems in the values themselves. In CRISP-DM it is one task of data preparation and can include estimating missing values with a model.[4]

Missing values need care, because the reason they are missing changes which fixes are valid. Donald Rubin sorted missing data into three classes in 1976.[6]

Class Meaning Example
Missing completely at random (MCAR) The chance of being missing is the same for every case A weighing scale runs out of battery
Missing at random (MAR) The chance is the same only within groups defined by the observed data A scale fails more often on soft floors, and floor type is recorded
Missing not at random (MNAR) Neither of the above holds People with weaker opinions answer a survey less often

Most simple fixes work only under MCAR and can give biased results when MCAR does not hold.[6] Filling in missing values with estimates is called imputation.

Values that look strange deserve a second look before they are trusted. Twyman's law states that "any figure that looks interesting or different is usually wrong".[7] Ronny Kohavi gives typical causes:[7]

  • many people born on 11/11/11 because a form forced a birth date
  • many "astronauts" because a drop-down list defaulted to its first entry
  • an hour with no web traffic, caused by the switch to daylight saving time

A value far from the rest is called an outlier. It may be an error or a real but rare event, so the analyst checks it rather than deleting it by habit.

Summarizing data with numbers

Descriptive statistics reduce a set of values to a few numbers. The two main kinds describe a typical value (location) and how spread out the values are (scale).[8][9]

Typical value

The mean, or average, is the sum of the values divided by how many there are:[8]

yˉ=1N∑i=1Nyi\bar{y} = \frac{1}{N}\sum_{i=1}^{N} y_i

Here y1,…,yNy_1, \dots, y_N are the NN data values and yˉ\bar{y} is their mean.

The median is the middle value once the data are sorted from smallest to largest.[8] With sorted values y(1)≤y(2)≤⋯≤y(N)y_{(1)} \le y_{(2)} \le \dots \le y_{(N)}:

y~={y((N+1)/2)if N is odd12(y(N/2)+y(N/2+1))if N is even\tilde{y} = \begin{cases} y_{((N+1)/2)} & \text{if } N \text{ is odd} \\ \tfrac{1}{2}\left(y_{(N/2)} + y_{(N/2+1)}\right) & \text{if } N \text{ is even} \end{cases}

The mode is the value that occurs most often, and a data set can have more than one.[8]

Spread

The variance is roughly the average squared distance from the mean, and the standard deviation is its square root:[9]

s2=1N−1∑i=1N(yi−yˉ)2,s=s2s^2 = \frac{1}{N-1}\sum_{i=1}^{N}\left(y_i - \bar{y}\right)^2, \qquad s = \sqrt{s^2}

This needs at least two values (N≥2N \ge 2). The standard deviation is in the same units as the data, while the variance is in squared units.[9]

Some measures of spread use percentiles. A percentile is a value below which a given percentage of the data falls, so 75% of values lie below the 75th percentile. Other common measures of spread are:[9]

  • the range, the largest value minus the smallest
  • the interquartile range, the 75th percentile minus the 25th percentile, which measures spread near the center
  • the median absolute deviation, the median of the distances from the median

Extreme values

Extreme values pull the mean and standard deviation, but barely move the median, interquartile range, or median absolute deviation.[8][9] Measures that resist extreme values are the subject of robust statistics.

An exercise quoted by Andrew Ehrenberg in 1975, in the earliest reference to Twyman's law that Kohavi found, shows this.[7] It lists the values 12, 10, 18, 12, 4, 14, 19, 10, 16, 104, 9, and 12, where the 104 may be a typing error. The mean of these 12 values is 240 / 12 = 20, which is above 11 of them, while the median is 12.

Mean and median of a data set with an outlier 0102030405060708090100110 median = 12 mean = 20 mean without 104 is about 12.4 possible typing error
Twelve values plotted on a number line: one extreme value at 104, possibly a typing error, pulls the mean up to 20, while the median stays at 12. Without that value the mean would be about 12.4.

The same pull happens in skewed data. When the right tail is heavier, the mean is larger than the median.[8] In a NIST example with 10,000 values from a right-skewed (exponential) distribution, the mean was 1.001 and the median 0.684.[8]

Looking at data with graphs

Exploratory data analysis (EDA) is an approach that lets the data show their own structure before any model is assumed.[10]

Its founding work is Tukey's 1977 book Exploratory Data Analysis.[10]

EDA relies mostly on graphs.[10] Common ones include:

  • histograms, which show how values are distributed
  • box plots, which show the median, the quartiles (the three values that split sorted data into four equal groups), and extreme values
  • scatter plots, which show how two variables relate
  • probability plots, which compare data with a chosen distribution

The wider field of drawing data is data visualization.

Anscombe's quartet

Summary numbers alone can hide what the data look like. In 1973 Francis Anscombe published four small data sets that share the same summary numbers:[11]

  • the same mean and variance
  • the same correlation, which measures how closely two variables move together along a straight line
  • the same fitted regression line, the straight line that best matches the points

When plotted, the four look completely different. The set is known as Anscombe's quartet.

Anscombe's quartet I II III IV 5 10 15 20 5 10 15 20 4 8 12 4 8 12 Same mean, variance, correlation, and fitted line
Anscombe's quartet: four data sets that share the same mean, variance, correlation, and fitted line y=3+0.5xy = 3 + 0.5x, but look very different when plotted. Set I is a loose linear cloud, II is a smooth curve, III is a tight line with one outlier, and IV is a vertical stack at x=8x = 8 plus one distant point.

Six types of questions

Leek and Peng sort every data analysis into one of six types.[2] Each later type asks more of the data and of the study design (how the study is planned and carried out) than the one before.

Type Goal Example from Leek and Peng
Descriptive Summarize the measurements in one data set without interpreting them The US Census counting how many people live in each area
Exploratory Search for trends or relationships to generate ideas Amateur astronomers finding a four-star planetary system in Kepler telescope data
Inferential Judge whether a pattern is likely to hold beyond the data at hand Whether air pollution relates to life expectancy across US states
Predictive Use some measurements to predict another for a single person or unit Using polls to predict how people will vote
Causal Find what happens to one measurement, on average, when another is changed Smoking raising the average risk of cancer
Mechanistic Show that changing one measurement always leads to a specific result in another How wing design changes air flow and lowers drag

Inferential analysis is the most common type in the scientific literature.[2] Mechanistic analysis is rarely possible outside engineering.[2] Questions of cause are the subject of causal inference.

Common mistakes

Treating one type of analysis as another is common enough to have its own phrases.[2]

Real type Treated as Name of the error
Inferential Causal Correlation does not imply causation
Exploratory Inferential Data dredging
Exploratory Predictive Overfitting
Descriptive Inferential "n of 1" analysis

Three approaches

The NIST/SEMATECH engineering statistics handbook compares three common approaches.[12]

All three start with a science or engineering problem and end with conclusions, but they order the middle steps differently.[12] The table uses a few terms:

  • Parameters are the values that set how a model behaves, such as the slope of a line.
  • Normality means the data follow a normal (bell-shaped) distribution, and linearity means a straight-line relationship.
  • A prior distribution is a probability description of what was believed about the parameters before seeing the data.
Approach Order of steps How the model is handled
Classical Problem, data, model, analysis, conclusions A model (such as normality or linearity) is chosen first, and analysis focuses on its parameters
Exploratory Problem, data, analysis, model, conclusions The data are analyzed first to find out which model fits
Bayesian Problem, data, model, prior distribution, analysis, conclusions Prior knowledge is added as a probability distribution on the model's parameters

The Bayesian approach combines the data with prior knowledge using probability.[12] In practice, analysts freely mix elements of all three.[12] The Bayesian approach rests on Bayesian inference and is the subject of the textbook Bayesian Data Analysis.

Models and how to check them

A statistical model describes how the data might have been produced. Common families include:

The right check depends on the question type.

  • Inferential questions are often checked with a statistical hypothesis test, part of statistical inference.
  • Predictive models are checked on data they were not built on. CRISP-DM recommends building the model on a training set and estimating its quality on a separate test set.[4] See training, validation, and test data sets.
  • Exploratory analyses can make discoveries but can rarely confirm them.[2] The Kepler planet needed follow-up studies and more data before it was confirmed.[2]

Pitfalls and safeguards

An analysis can be fully reproducible and still be wrong.[2] Several problems come from the freedom analysts have in making choices.

The garden of forking paths

Andrew Gelman and Eric Loken described how choices that depend on the data create hidden multiple comparisons.[13] Multiple comparisons means running many tests, so that some succeed by chance alone.

An analyst may run only one test, but if the choice of test would have changed with different data, many comparisons were possible.[13] This can produce false findings even when the analyst does not deliberately try many analyses.[13]

Forking paths in data analysis Data yes no A B A B everyone one subgroup everyone one subgroup everyone one subgroup everyone one subgroup 1 2 3 4 5 6 7 8 the analysis reported Exclude outliers? Outcome measure Group analyzed possible analyses
Three yes-or-no choices made after seeing the data (whether to exclude outliers, which outcome measure to use, and which group to analyze) give 2×2×2=82 \times 2 \times 2 = 8 possible analyses. Only one path, highlighted, ends up as the analysis reported.

A result is called statistically significant when its p-value (the chance of a result at least this extreme if there were no real effect) falls below a chosen cutoff. In other words, the result would be unlikely if chance alone were at work.

Gelman and Loken note that without preregistration, analysis choices depend on the data, so a statistically significant result from the chosen path is not strong evidence for the hypothesis.[13]

Related ideas are the forking paths problem, researcher degrees of freedom, and the multiple comparisons problem.

Many analysts, one data set

In a 2018 study, 29 teams analyzed the same data on whether football (soccer) referees give more red cards to dark-skinned players.[14] Twenty teams (69%) found a statistically significant positive relationship, with a p-value below 0.05, and nine (31%) did not.[14] This approach, giving one data set to many teams, is called crowdsourced analysis.

Safeguards

  • Preregistration. The analysis plan is fixed and recorded before the data are seen.[13]
  • Blind analysis. Some aspect of the data or result is hidden until the analysis is final, to prevent the analyst's own bias.[15]
  • Reproducibility. Roger Peng urged researchers to publish their code and, next, cleaned code with the data in a lasting format not controlled by one company.[16]
  • Labeling each step. Leek and Peng advise labeling each step of an analysis by its original intent, so secondary results are not given the weight of the main one.[2]

Confusion over question types is central to the replication crisis, according to Leek and Peng.[2]

Tools and practitioners

Two widely used open-source tools are:

  • R, "a language and environment for statistical computing and graphics"[17]
  • pandas, a data analysis and manipulation tool built on the Python programming language[18]

The US Bureau of Labor Statistics describes data scientists as workers who "use analytical tools and techniques to extract meaningful insights from data".[19] Their listed duties include:[19]

  • collecting and analyzing data
  • building and testing models
  • presenting findings with charts and other graphics

The bureau reports a median annual wage of $120,230 for data scientists in May 2025. It projects 35% job growth from 2025 to 2035.[19]

History

Key works in the modern history of data analysis include:

    1. Tukey publishes "The Future of Data Analysis" in the Annals of Mathematical Statistics.[1]
    1. Anscombe publishes "Graphs in Statistical Analysis", with his four data sets.[11]
    1. Andrew Ehrenberg cites Twyman's law, the earliest scholarly reference Kohavi found.[7]
    1. Rubin sets out classes of missing data.[6]
    1. Tukey publishes Exploratory Data Analysis, and Frederick Mosteller and Tukey publish Data Analysis and Regression.[10]
    1. The CRISP-DM 1.0 guide is published.[4]
    1. Wickham defines tidy data.[5]
    1. Leek and Peng classify six types of data analysis questions.[2]

References

  1. The Future of Data Analysis, John W. Tukey, Annals of Mathematical Statistics, 1962.
  2. What is the question?, Jeffery T. Leek and Roger D. Peng, Science, 2015.
  3. R for Data Science (2e): Introduction, Hadley Wickham, Mine Çetinkaya-Rundel, and Garrett Grolemund, O'Reilly, 2023.
  4. CRISP-DM 1.0: Step-by-step data mining guide, CRISP-DM consortium, 2000.
  5. Tidy Data, Hadley Wickham, Journal of Statistical Software, 2014.
  6. Concepts of MCAR, MAR and MNAR, Stef van Buuren, Flexible Imputation of Missing Data (2nd ed.), 2018.
  7. Twyman's Law and Controlled Experiments, Ronny Kohavi, ExP Platform, 2017.
  8. Measures of Location, NIST/SEMATECH e-Handbook of Statistical Methods, NIST.
  9. Measures of Scale, NIST/SEMATECH e-Handbook of Statistical Methods, NIST.
  10. What is EDA?, NIST/SEMATECH e-Handbook of Statistical Methods, NIST.
  11. Anscombe's Quartet of 'Identical' Simple Linear Regressions, R Documentation (citing Anscombe, The American Statistician, 1973).
  12. How Does Exploratory Data Analysis differ from Classical Data Analysis?, NIST/SEMATECH e-Handbook of Statistical Methods, NIST.
  13. The garden of forking paths, Andrew Gelman and Eric Loken, Columbia University, 2013.
  14. Many Analysts, One Data Set, R. Silberzahn et al., Advances in Methods and Practices in Psychological Science, 2018.
  15. Blind Analysis in Nuclear and Particle Physics, Joshua R. Klein and Aaron Roodman, Annual Review of Nuclear and Particle Science, 2005.
  16. Reproducible Research in Computational Science, Roger D. Peng, Science, 2011.
  17. What is R?, The R Project for Statistical Computing.
  18. pandas: Python Data Analysis Library, pandas project.
  19. Data Scientists, Occupational Outlook Handbook, U.S. Bureau of Labor Statistics, 2026.

Figure