Biostatistics and Data Science
Exploratory Data Analysis
1. What Exploratory Data Analysis Is
Exploratory Data Analysis (EDA) is the process of examining, organizing, visualizing, and modeling data to discover patterns, identify problems, and generate hypotheses.
EDA is not limited to a particular programming language or software package. The same principles apply whether the analysis is conducted in R, Python, SAS, or another environment.
The central goals of EDA are to:
Understand the structure and content of a dataset.
Detect errors, unusual values, and missing-data problems.
Identify trends, relationships, clusters, and unexpected patterns.
Determine whether the data are capable of answering the intended research questions.
Generate hypotheses for later investigation.
Build an accurate understanding of the data before conducting formal analyses.
Plots are especially important because visual representations can reveal patterns that are difficult or impossible to detect from tables, averages, correlations, or written summaries alone.
EDA is fundamentally about learning what the data contain before deciding exactly what conclusions should be drawn from them.
2. Exploratory and Confirmatory Data Analysis
Exploratory Data Analysis
EDA emphasizes discovery and hypothesis generation. The analyst examines the data in a relatively flexible and open-ended way, looking for patterns that may suggest explanations or future research questions.
Typical features of EDA include:
Flexible analysis plans.
Repeated examination of data from different perspectives.
Extensive use of plots and summaries.
Investigation of unexpected findings.
Use of statistical models as descriptive or exploratory tools.
Relatively loose control of error rates.
Development of hypotheses during the analytical process.
EDA can still involve uncertainty quantification and error-rate considerations, but these are usually less formal and less strictly specified than in confirmatory work.
Confirmatory Data Analysis
Confirmatory Data Analysis (CDA) focuses on testing or confirming hypotheses that have generally been specified before examining the relevant data.
Typical features of CDA include:
Formal statistical inference.
Prespecified hypotheses.
Planned analysis procedures.
Protocolized methods.
Formal prediction and estimation techniques.
More explicit control of error rates.
A stronger distinction between primary and secondary analyses.
Clinical trials, especially trials used in drug development, are often strongly confirmatory. Their protocols, outcomes, statistical tests, and analysis procedures are typically established in advance.
EDA and CDA as a Spectrum
EDA and CDA are often presented as opposites, but most real-world analyses fall somewhere between the two.
Highly regulated clinical trials tend toward the confirmatory end.
High-throughput measurement fields such as genomics often require substantial exploration.
Many scientific projects combine exploratory and confirmatory components.
The distinction is therefore often more useful conceptually than as a strict practical division. A single project may begin with extensive exploration, followed by formal confirmation using new data or a prespecified analysis.
An alternative distinction is whether research is driven by:
Strongly phrased scientific hypotheses, or
Purely empirical investigation, in which patterns are sought without a tightly specified initial hypothesis.
This distinction can sometimes be more informative than simply labeling an analysis “EDA” or “CDA.”
3. The Danger of Presenting Exploration as Confirmation
P-Hacking and Fishing Expeditions
A major problem occurs when researchers conduct extensive exploratory analyses, find an interesting pattern, and then present the final analysis as though it had been planned from the beginning.
This practice is commonly associated with:
P-hacking
Data fishing
Fishing expeditions
Selective reporting
Repeated hypothesis testing without appropriate adjustment
The more extensively the same dataset is used to generate hypotheses, select variables, try different transformations, and search for associations, the more difficult it becomes to use that dataset for unbiased confirmatory inference.
The central issue is that repeated searches increase the chance of finding an apparently meaningful result purely by chance. If only the successful final analysis is reported, readers may incorrectly believe that the result was predicted in advance.
Why the Error Rate Changes
A formal statistical test generally assumes that the analysis procedure is known in advance or that the search process has been properly accounted for. When researchers make many informal decisions before conducting the reported test, the nominal error rate no longer accurately reflects the real probability of a false positive.
For example, repeatedly changing:
The outcome variable.
The predictor variables.
The subgroup definitions.
The transformation of a variable.
The exclusion criteria.
The statistical model.
The cutoff for significance.
can create many opportunities to obtain a seemingly significant result.
Responsible Separation of EDA and CDA
Responsible practice requires distinguishing between:
Findings discovered through exploration.
Findings tested through a prespecified confirmatory analysis.
Possible strategies include:
Clearly labeling results as exploratory.
Recording the analytical steps that were tried.
Using new or independent data for confirmation.
Prespecifying a final analysis after the exploratory stage.
Adjusting for multiple comparisons when appropriate.
Avoiding presentation of an exploratory result as if it were an a priori prediction.
Exploratory analysis is valuable, but exploratory findings should not automatically be treated as confirmed scientific evidence.
4. A General EDA Workflow
A useful EDA workflow includes the following broad stages:
Read the data.
Understand the dataset.
Preprocess and organize it.
Check dimensions and compatibility.
Inspect values and create tables.
Investigate missing data.
Create plots.
Evaluate results critically and avoid self-deception.
These steps are not always strictly linear. Analysts often move back and forth between them as new problems or questions arise.
Reading the Data
The first stage involves importing the data and verifying that the data were read correctly. Important checks include:
Whether all expected variables were imported.
Whether variable types were interpreted correctly.
Whether rows and columns are present in the expected order.
Whether dates, categories, and numeric values were parsed correctly.
Whether special missing-data codes were converted appropriately.
Understanding the Dataset
After import, the analyst should determine:
What each column represents.
What each row represents.
Which variables are continuous, categorical, ordinal, binary, or identifiers.
Which variables are outcomes, predictors, covariates, or metadata.
What units are used.
What ranges are scientifically plausible.
A dataset cannot be analyzed responsibly without understanding what its variables mean.
Checking Dimensions and Merging Datasets
When multiple datasets are being combined, their dimensions and identifiers should be checked carefully.
Important questions include:
Do the datasets contain the same number of subjects or observations?
Are the identifiers consistent?
Are there duplicate identifiers?
Are rows being matched in the correct order?
Are variables measured at compatible time points?
Are observations accidentally being duplicated during a merge?
Are some observations present in one dataset but absent from another?
Dimension mismatches can produce analyses that run successfully but are scientifically incorrect.
Inspecting Values and Tables
Values should be inspected for:
Impossible measurements.
Implausible extreme values.
Incorrect units.
Typographical errors.
Unexpected categories.
Duplicated observations.
Values outside the intended measurement range.
Simple frequency tables and summary tables are often effective for finding such problems.
Investigating Missing Data
Missing data should be examined systematically.
The analyst should determine:
How missing values are coded.
How much data are missing.
Which variables contain missing values.
Which subjects or observations contain missing values.
Whether missingness is concentrated in particular groups.
Whether missing values are coded consistently across datasets.
Whether missingness follows a time-related or structural pattern.
A code such as NA is commonly used to represent missingness. In contrast, values such as 888 or 999 can be dangerous if the analysis software interprets them as legitimate numerical measurements.
Missingness itself may contain information. For example, a particular group may have more missing observations because of difficulties with measurement, dropout, or a condition affecting data collection.
Plotting
Plots are the cornerstone of EDA. They allow the analyst to examine distributions, relationships, group differences, trends over time, and unusual observations.
Useful exploratory plots may include:
Histograms and density plots.
Boxplots.
Scatterplots.
Line plots.
Residual plots.
Heat maps.
Grouped plots.
Multivariate displays.
Diagnostic plots.
Avoiding Self-Deception
The final stage is a critical evaluation of the findings. Analysts should ask:
Could this pattern be caused by a data error?
Is the dataset appropriate for the question?
Was the pattern found only after many searches?
Are there plausible alternative explanations?
Is the finding representative of the entire dataset?
Could the apparent association be due to an outlier or confounder?
Has the analysis been influenced by expectations?
5. Data Preprocessing and Data Wrangling
Data Preparation Is Real Analytical Work
Data wrangling is the process of cleaning, reshaping, combining, and organizing data into a usable form.
It should not be treated as work that occurs before the “real” analysis. Data preparation is often one of the most important parts of a project because mistakes at this stage can invalidate every later result.
A well-organized dataset provides the foundation for:
Reliable summaries.
Correct visualizations.
Reproducible analyses.
Valid statistical models.
Easier collaboration.
Efficient debugging.
A useful principle is to try to organize data into a rectangular format:
Each row represents an observation or observational unit.
Each column represents a variable.
Each cell contains one value.
Variable names and data types are consistent.
Good Practices for Data Organization
Important preprocessing practices include:
Use sensible, consistent column names.
Avoid spaces, quotation marks, and unusual symbols in variable names.
Use names that work reliably in statistical software.
Follow a programmer-like naming convention.
Keep data separate from graphs and presentation materials.
Store graphs on separate sheets or in separate files.
Record how modified copies of datasets were created.
Avoid mixing explanatory text, charts, and raw observations in the same table.
Preserve the original raw dataset separately from cleaned versions.
Spreadsheet files can be especially problematic when they contain embedded graphs, manually formatted cells, inconsistent labels, or multiple unrelated tables. Even when a spreadsheet is used, it is preferable to create a clean data copy and document each transformation.
Missing Values Must Not Be Represented as Ordinary Numbers
A common error is to encode missing values with arbitrary numbers such as 888 or 999.
For example:
A missing age coded as 999 may inflate the average age.
A missing weight coded as 888 may produce an impossible distribution.
A missing test score coded as 999 may be treated as a high score.
A missing measurement coded as 0 may be mistaken for a real zero.
The software may not know that these numbers represent missingness. As a result, the values can affect:
Means and standard deviations.
Regression coefficients.
Correlations.
Histograms and boxplots.
Group comparisons.
Model diagnostics.
Missing values should instead be represented using the missing-data conventions recognized by the analysis software.
Reproducibility and Version Control
Preprocessing steps should be saved and documented. Recommended practices include:
Use scripts rather than relying exclusively on manual editing.
Save intermediate datasets when appropriate.
Keep a record of transformations.
Use version control systems such as Git.
Maintain a clear distinction between raw, processed, and analysis-ready data.
Make it possible for another analyst to reproduce the final dataset.
Reproducibility is especially important because data cleaning often involves many small decisions that are difficult to remember or reconstruct later.
Data-Wrangling Tools
Modern statistical environments provide tools for reshaping and cleaning data. In R, commonly used tools include:
dplyrfor data manipulation.tidyrfor reshaping data.purrrfor functional programming and repeated operations.stringrfor string processing.ggplot2for visualization.
A structured data format makes plotting and modeling easier because the software can interpret variables consistently.
6. Avoiding Self-Deception in EDA
EDA is powerful partly because it allows analysts to search broadly. That flexibility also creates opportunities for unconscious bias and false discoveries.
The Elephant and the Blind Men
The parable of several blind men examining an elephant illustrates the limitations of partial information.
Each person touches a different part of the elephant and forms a different conclusion:
One person feels the side and thinks it is a wall.
Another touches the trunk and thinks it is a snake.
Others infer different objects from other parts.
The lesson for data analysis is that the observed data provide only a partial view of reality. A dataset may omit important variables, populations, time periods, or measurements.
Analysts should ask:
What information is not represented?
Which populations are missing?
Could the measurement process exclude important cases?
Does the dataset actually address the scientific question?
Are conclusions being generalized beyond the available evidence?
A true pattern in the observed data may still fail to provide a complete picture.
Shooting an Arrow and Drawing the Bull’s-Eye Afterwards
This metaphor describes finding a pattern and then acting as if it had been the original target.
The problem is especially serious when analysts:
Search for many possible relationships.
Select the most interesting finding.
Ignore unsuccessful searches.
Construct a post hoc explanation.
Present the result as a planned hypothesis.
This practice is related to confirmation bias, in which evidence supporting an existing expectation is emphasized while contradictory evidence is overlooked.
Looking for the Quarter Under the Lamppost
In this parable, a person drops a quarter in a dark area but searches under a nearby lamppost because the light is better.
The analytical equivalent is examining only the data that are easiest to access or analyze, even when those data are not the most relevant to the question.
Examples include:
Using a convenient variable instead of the scientifically appropriate variable.
Studying a readily available subgroup while ignoring important populations.
Choosing a measurement because it is easy to model rather than because it represents the concept of interest.
Restricting attention to patterns visible in the available data.
The key lesson is that analytical convenience should not determine the scientific question.
Multiplicity: Searching Until Something Appears
Multiplicity occurs when many hypotheses, variables, subgroups, outcomes, transformations, or models are examined.
Even if every individual test has a low false-positive probability, the chance of finding at least one apparently significant result increases as the number of opportunities increases.
A simple example is repeatedly testing whether different colors of jellybeans are associated with acne. If enough colors are tested, one color may show an association by chance alone. Reporting only that color creates the false impression of a targeted discovery.
Multiplicity can arise from:
Testing many variables.
Testing many outcomes.
Examining multiple subgroups.
Trying multiple statistical models.
Repeating analyses after seeing results.
Looking at data at many time points.
Trying different transformations or exclusions.
Common Ways Analysts Fool Themselves
The major risks can be summarized as follows:
Inadequate data: The dataset cannot answer the intended question.
Incomplete evidence: A true finding does not represent the whole phenomenon.
Confirmation bias: Evidence supporting expectations is favored over contradictory evidence.
Chance associations: A pattern appears because of random variation.
Multiplicity: Repeated searching eventually produces an apparently interesting result.
Preprocessing errors: Incorrect coding, units, or values reverse or distort findings.
Overconfidence in visual patterns: Human perception detects patterns even in random noise.
These risks are especially pronounced in EDA because exploratory work is usually flexible and not fully protocolized.
7. Why Plots Are Central to EDA
Plots can reveal information that summary statistics conceal. A numerical summary may accurately describe certain aspects of a dataset while completely missing its structure.
Visualizing Complex Data
A well-designed plot can show:
Trends.
Clusters.
Outliers.
Missing-data patterns.
Nonlinear relationships.
Heteroscedasticity.
Group differences.
Changes over time.
Data concentration and sparsity.
Model failures.
Visual information can communicate relationships more directly than a table of numbers.
Lasagna Plots and Spaghetti Plots
A spaghetti plot displays many individual trajectories, often across time. Although it preserves individual-level information, a large number of overlapping lines can create a dense black mass through overplotting.
A lasagna plot uses a heat-map structure instead. Typically:
Rows represent subjects or observational units.
Columns represent time points or ordered measurements.
Color represents the measured value.
This approach can make broad patterns easier to see, including:
Group-level differences.
Temporal trends.
Missing-data patterns.
Clusters of similar trajectories.
Changes that are obscured by overlapping lines.
Lasagna plots may use substantial visual ink, but they can still be valuable because they display the full dataset in a structured form. Sorting or organizing rows is often essential because a useful ordering can make patterns much easier to detect.
Minard’s Visualization of the 1812 French Invasion
A historically important example of information-rich visualization depicts Napoleon’s invasion and retreat from Russia.
The visualization combines several variables in one display:
Geographic route.
Direction of travel.
Number of troops.
Detachments that broke away from the main force.
Retreat path.
Temperature during the campaign.
Major locations.
The width of the troop path represents the number of soldiers remaining. The French army began with approximately 422,000 troops, but the width narrows dramatically during the campaign and retreat. By the time the army returned, only a small fraction remained.
The graph communicates the effects of:
Military attrition.
Retreat.
Lack of resupply.
Scorched-earth tactics.
Extreme cold.
Starvation and exhaustion.
This example illustrates how a single plot can integrate multiple dimensions of information while preserving a coherent narrative.
Anscombe’s Quartet
Anscombe’s quartet consists of four datasets with nearly identical basic numerical summaries, including:
Mean of the x values.
Mean of the y values.
Variability of the x values.
Variability of the y values.
Correlation.
Regression slope.
Coefficient of determination, R2.
Despite these identical summaries, the four scatterplots tell very different stories:
One dataset shows an ordinary noisy linear relationship.
One shows a curved, approximately parabolic relationship.
One shows a nearly perfect line driven by a single outlier.
One shows little variation in x except for one influential observation.
The lesson is fundamental:
Numerical summaries and regression coefficients cannot substitute for plotting the data.
A model can produce apparently reasonable results while failing to represent the actual structure of the observations.
Residual Plots
Residual plots are essential for checking whether a regression model is appropriate.
A model may appear satisfactory when only coefficients and significance values are examined. However, plotting predicted values against residuals can reveal:
Nonlinearity.
Unequal variance.
Outliers.
Dependence.
Model misspecification.
Hidden structure.
A striking example involves deliberately constructed data whose residuals form a recognizable image. The regression output may look ordinary, but the residual plot exposes a pattern that the model failed to capture.
This demonstrates that diagnostic plots are not optional decorations. They are tools for evaluating whether a model has adequately explained the data.
8. Principles of Effective Plot Design
Maximize the Data-to-Ink Ratio
A key visualization principle is to maximize the data-to-ink ratio: as much of the visual content as possible should communicate meaningful information about the data.
A related practical formulation is:
Every visual element should justify its presence by conveying useful information.
A plot that displays individual observations, group summaries, and uncertainty can communicate much more than a bar chart that displays only group means.
Why Bar Charts Can Be Misleading or Inefficient
A bar chart may use a large amount of visual material to represent only a few summary values. It often hides:
Individual observations.
Distributional shape.
Outliers.
Within-group variation.
Differences in sample size.
Clustering.
When possible, alternatives such as dot plots, strip plots, boxplots, violin plots, or jittered observations can display more of the underlying data.
Decorative elements that often add little information include:
Heavy backgrounds.
Excessive gridlines.
Unnecessary borders.
Three-dimensional effects.
Large empty regions.
Redundant labels.
Visual embellishments unrelated to the data.
Avoid Unnecessary Three-Dimensional Graphics
For ordinary plots, three-dimensional displays should generally be avoided.
Three-dimensional effects can:
Distort apparent lengths and areas.
Create occlusion.
Introduce optical illusions.
Make comparisons dependent on viewing angle.
Reduce the amount of information that can be accurately perceived.
Rotating a three-dimensional chart can make its values appear to change even though the underlying data remain constant.
Three-dimensional visualization can be appropriate when the data themselves are genuinely three-dimensional, such as brain-imaging data. Even then, the third dimension should be used carefully and should improve, rather than merely decorate, the display.
Use Logarithmic Scales When Orders of Magnitude Matter
A logarithmic transformation is useful when values span several orders of magnitude.
Common transformations include:
Natural logarithm.
Base-2 logarithm.
Base-10 logarithm.
Without a logarithmic scale, small values may be compressed near zero while large values dominate the display. Important variation among the smaller observations may disappear.
Logarithmic scales are especially useful for:
Gene-expression measurements.
Astronomical distances.
Concentrations.
Population sizes.
Financial or economic quantities.
Any measurement covering several powers of ten.
The choice of scale should reflect the scientific meaning of the data. If relative differences or orders of magnitude matter more than absolute differences, a log scale may provide a much more informative view.
Mean-Difference Plots on a Log Scale
For two expression measurements, a mean-difference plot can display:
The log ratio between two measurements on one axis.
The average log expression level on the other axis.
This type of plot can be more informative than a standard scatterplot because it:
Represents relative differences naturally.
Rotates the relationship to reduce unnecessary blank space.
Shows the bulk of the observations more clearly.
Can reveal how variability changes with average expression.
Makes patterns in high- and low-expression measurements easier to compare.
Plotting untransformed values may leave most observations compressed in a small region while a few large values occupy most of the graph. A log-based display can prevent the analyst from focusing disproportionately on a small fraction of the data.
9. The Psychology of Plots
Exploratory plots are generally created quickly for the analyst or research team rather than finalized for publication. Their primary goal is personal or group understanding, not visual polish.
Because many plots may be created during EDA, the process should emphasize information and rapid iteration.
Practical Features of Exploratory Plots
Exploratory plots should generally include:
Clearly labeled axes.
Measurement units.
Understandable tick marks.
Scales appropriate to the data.
Colors used to distinguish meaningful groups.
Size used to communicate meaningful quantitative information.
Minimal decoration.
A plot does not need to be publication-ready during the exploratory phase, but it must still be interpretable.
Human Perception Is Imperfect
Humans are highly sensitive to patterns. This is useful for discovering structure, but it also creates a danger: people may perceive patterns where none exist.
Visual judgments can be affected by:
Surrounding objects.
Framing.
Relative position.
Color and shading.
Plot scale.
Aspect ratio.
Viewing angle.
Neighboring values.
For example:
Two circles of equal size may appear different because their surrounding circles differ in size.
Two squares with the same shade of gray may appear different because of surrounding colors and shadows.
The apparent strength of a relationship may change when a plot is zoomed in or out.
These effects mean that visual impressions should be checked against numerical summaries, alternative plots, and appropriate statistical reasoning.
10. Perceptual Tasks in Graph Reading
Research on graphical perception breaks plot interpretation into basic perceptual tasks, sometimes described as the fundamental units of graph reading.
Examples include comparing:
Lengths.
Positions on a common scale.
Positions on separate or nonaligned scales.
Angles.
Directions.
Areas.
Volumes.
Curvature.
Shading.
Slopes.
People perform these tasks with different levels of accuracy.
Position on a Common Scale
Comparisons based on position along a shared axis are generally among the most accurate. This is similar to comparing two points on the same ruler.
Examples include:
Comparing the values of two points on a common vertical axis.
Comparing bars that share the same baseline and scale.
Comparing aligned confidence intervals.
When possible, graph designs should rely on common scales and directly comparable positions.
Length Comparisons
Length comparisons can be reasonably accurate when the objects are aligned and placed near one another. They become more difficult when:
The objects are separated.
They are displayed in different regions.
They use different baselines.
They are placed on nonaligned scales.
This is one reason that directly adjacent displays are often easier to interpret than separated or independently scaled displays.
Angle Comparisons and Pie Charts
People are generally poor at comparing angles accurately. This creates a major limitation for pie charts, where quantities are represented by the angles of slices.
Pie charts can make it difficult to determine:
Which category is larger.
How much larger one category is than another.
Whether two similar-sized categories are actually different.
The relative sizes of several categories.
Bars or points positioned on a common scale usually support more accurate comparisons.
Slope Comparisons
Comparing slopes is also difficult. The perceived steepness of a line can change when the plot is:
Stretched horizontally.
Compressed horizontally.
Stretched vertically.
Compressed vertically.
Rotated.
Displayed with a different aspect ratio.
Readers may therefore be asked to perform a difficult mental calculation when a graph encourages comparison of slopes. Analysts should use caution when interpreting apparent differences in trend steepness.
Area and Volume Comparisons
Displays based on area and volume are generally less precise than displays based on position. Three-dimensional shapes can be especially difficult to compare because the visual impression of volume does not correspond linearly to the numerical quantity.
This is another reason to avoid using circles, spheres, or three-dimensional bars when simpler position-based displays can communicate the same information.
11. How Scale Affects Interpretation
The scale and aspect ratio of a graph can influence how viewers perceive patterns.
Perceived Correlation
Scatterplots with the same actual correlation can appear to have different strengths of association depending on:
The axis limits.
The degree of zoom.
The aspect ratio.
The amount of empty space.
The shape of the plotting region.
Viewers may estimate a correlation as stronger or weaker simply because the graph has been displayed at a different scale.
People tend to identify correlations accurately when they are near:
No association.
A nearly perfect positive or negative association.
Intermediate correlations are often more difficult to judge visually. A moderate association may be overestimated or underestimated depending on the display.
Implications for Analysts
To reduce misleading visual impressions:
Use sensible axis limits.
Avoid arbitrary stretching or compression.
Use comparable scales across related plots.
State the numerical correlation when it matters.
Do not rely entirely on visual estimates.
Compare the data with appropriate statistical summaries.
The graphing scale is part of the analytical context, not a neutral feature.
12. Informal Hypothesis Testing Through Plots
Each time an analyst creates a plot and decides that it shows a meaningful pattern, an informal hypothesis test has effectively taken place.
For example:
The analyst creates a plot.
A pattern appears.
The analyst decides that the pattern may be real.
A new plot or model is created to investigate it.
Another conclusion is drawn.
This repeated process involves many informal decisions. Although it may not use formal test statistics, it still creates opportunities for false discoveries.
Permutation-Based Visual Comparisons
One approach to visual reasoning is to compare the observed data with datasets generated by permuting or rearranging the observations.
The process is:
Plot the observed dataset.
Create datasets in which relevant values are randomly permuted.
Plot the permuted datasets.
Compare the observed pattern with the patterns produced under random rearrangement.
This creates a visual analogue of a hypothesis test. If the observed pattern looks unusual relative to the permuted examples, it may provide evidence that the relationship is not merely random.
However, visual comparison does not eliminate the need for careful reasoning. Repeatedly inspecting many plots can still introduce selection and multiplicity problems.
13. Regression Diagnostics and Data Errors
Preprocessing errors can substantially alter the conclusions of an analysis.
Common examples include:
Missing values coded as 888 or 999.
A weight of 200 entered as 2,000.
A variable entered in the wrong units.
A category assigned the wrong label.
An outcome or predictor reversed.
Rows matched to the wrong subjects.
Extreme values entered through typographical errors.
These problems can:
Reverse the direction of an effect.
Create a false association.
Hide a real association.
Inflate variability.
Produce misleading regression coefficients.
Create apparently significant results.
In addition to plotting and checking raw values, regression diagnostics can help identify influential observations. Examples include:
DFFITS, which assesses how much an observation affects fitted values.
DFBETAS, which assesses how much an observation affects individual regression coefficients.
Residual plots.
Leverage measures.
Influence diagnostics.
A complete analysis should combine data inspection, visual exploration, and model diagnostics.
14. Software and Implementation
General Software Guidance
Most major statistical analysis environments have adequate graphics capabilities. The choice of software is usually less important than:
Understanding the data.
Using appropriate graphical principles.
Checking assumptions.
Documenting the analysis.
Interpreting visualizations carefully.
R and Base Graphics
R’s base graphics provide a broad set of plotting functions and remain useful, especially for analysts familiar with R.
The Grammar of Graphics
The grammar of graphics is a framework for constructing plots by combining components such as:
Data.
Aesthetic mappings.
Geometric objects.
Scales.
Coordinate systems.
Statistical transformations.
Facets and layers.
In R, this framework is implemented most prominently through ggplot2.
A major advantage of this approach is that it encourages analysts to first organize the data into a clean, consistent structure. Once the data are properly formatted, a wide range of plots can be created systematically.
Interactive Graphics
Interactive graphics allow users to manipulate or explore a visualization through:
Sliders.
Buttons.
Menus.
Dialog boxes.
Zooming.
Filtering.
Hovering over observations.
Interactive graphics can be useful when:
The dataset is large.
Many variables need to be explored.
The user wants to inspect individual observations.
Multiple views of the same data are useful.
Static plots would become overcrowded.
Examples of tools include:
Plotly
Shiny
D3, a JavaScript visualization library
D3 is highly flexible but requires substantial programming knowledge. Tools built on top of visualization libraries can provide interactivity with less development effort.
15. Broader EDA Methods and Resources
EDA includes more than plotting. Statistical and machine-learning methods can also be used exploratorily.
Examples include:
Regression modeling.
Clustering.
Dimension reduction.
Variable screening.
Confounder investigation.
Unsupervised learning.
Feature construction.
Model comparison.
Pattern detection.
A regression model can be used exploratorily to:
Add or remove potential confounders.
Examine how relationships change after adjustment.
Investigate possible interactions.
Identify unusual observations.
Explore candidate predictors.
Generate hypotheses for later testing.
The same method can therefore serve either an exploratory or confirmatory purpose depending on how it is used, when decisions are made, and how the results are interpreted.
Learning Resources
Useful areas of study include:
Practical EDA tutorials for specific software.
Data-wrangling guides.
Statistical graphics and visualization.
Human perception of graphs.
Regression diagnostics.
Machine learning and clustering.
The foundational work on exploratory analysis and graphical perception.
The plotting component of EDA is relatively well developed, with extensive work on:
Visual design.
Perceptual accuracy.
Graph construction.
Software implementation.
The broader theory of how models are used in EDA is more flexible and less sharply defined. Students may need to combine material from statistics, machine learning, clustering, and regression rather than rely on a single unified framework.
16. Key Principles for Practice
A responsible EDA process follows these principles:
Understand the data before modeling it.
Treat preprocessing as substantive analytical work.
Organize data into a clean rectangular structure.
Use explicit and consistent missing-data codes.
Save preprocessing steps and use version control.
Check dimensions, identifiers, units, and ranges.
Use plots to examine the full structure of the data.
Inspect residuals and influential observations.
Prefer information-rich plots to decorative displays.
Use common scales whenever possible.
Avoid unnecessary three-dimensional graphics.
Use logarithmic scales when orders of magnitude matter.
Recognize that human perception can create misleading impressions.
Distinguish exploratory findings from confirmatory evidence.
Account for multiplicity and repeated searching.
Do not ignore evidence that contradicts an expected result.
Do not assume that a true pattern provides a complete explanation.
Avoid treating a chance discovery as a prespecified hypothesis.
Do not respond to the risk of false positives by assuming that every finding is meaningless.
The purpose of EDA is not to prove a hypothesis immediately. It is to develop an accurate, critical, and evidence-based understanding of what the data can and cannot show.

Ask anything
We've read this whole study set, so questions about it get the best answers.