Explanation 1
The live starter code is self-contained and uses only runner-compatible functions.
Loading
Lesson 7 of 22
Describe centre, spread, shape, relationships, and unusual observations without turning discovery into confirmation.
Motivation
EDA reveals scale, structure, and quality problems before a model compresses the data into coefficients.
Why this matters
Describe centre, spread, shape, relationships, and unusual observations without turning discovery into confirmation.
Packages and data
Base stats; ggplot2 is optional for polished graphics.
Explanation 1
The live starter code is self-contained and uses only runner-compatible functions.
Explanation 2
Book-only outputs are labelled when the separate source dataset or advanced package was not supplied.
Explanation 3
R code, paths, function names, and formulas remain left-to-right in every locale.
Terminology
Typical location measured by statistics such as mean or median.
Median resists extreme values
Variation measured by SD, IQR, or quantiles.
Report the unit and period
Pattern discovery that generates questions and checks assumptions.
Not untouched confirmatory evidence
Notation and formulas
IQR = Q3 - Q1
The IQR spans the middle half and is less sensitive to tails than the standard deviation.
Worked example
Scenario
What do centre, spread, and quantiles reveal about an illustrative inflation sample?
R check
x <- c(1.4,1.9,2.1,2.3,2.7,3.4,4.8,6.2)
print(c(mean=mean(x), median=median(x), sd=sd(x), IQR=IQR(x)))
print(quantile(x, c(.25,.5,.75)))
hist(x, breaks=5, main='Inflation distribution', xlab='Percent')The sample is right-skewed, so centre should be described with both mean and median. Limitation: Histogram appearance depends on bin boundaries, and eight observations cannot establish a population distribution.
Visual
Counts thin into the upper tail.
R connection
Run the self-contained starter code in the protected STATLAB R runner. The code prints an auditable result and avoids network or unrestricted file access.
Live R Lab
Run a self-contained example, verify its output, and explain one limitation for exploratory data analysis.
Ready to run
Common mistake
Points beyond 1.5 IQR are flags, not automatically errors.
STATLAB Tip
Describe what the plot shows, a plausible interpretation, and what evidence is still needed.
Guided practice
Scenario
Plot an empirical CDF and compare its quartiles with quantile().
Compare your result with the definition, units, and model assumptions—not only with a target number.
Exercises
Complete these without looking at the selected solutions. More than one defensible program may exist.
Explanation 1
Compare mean, median, SD, and IQR.
Explanation 2
Draw histograms with two bin counts.
Explanation 3
List two reasons a scatterplot is not causal evidence.
Selected solutions
These are compact solution routes. Confirm dimensions, units, and any changed modelling choices.
Explanation 1
c(mean=mean(x), median=median(x), sd=sd(x), IQR=IQR(x))
Explanation 2
Use hist(x, breaks=3) and hist(x, breaks=8); observations do not change.
Explanation 3
Confounding and reverse timing remain possible.
Chapter summary
Describe centre, spread, shape, relationships, and unusual observations without turning discovery into confirmation.
Explanation 1
Report centre, spread, shape, and context.
Explanation 2
Graphics have tuning choices.
Explanation 3
Investigate unusual observations.
Explanation 4
Exploration is not confirmation.
Terminology
centre
Use in Exploratory Data Analysis.
spread
Use in Exploratory Data Analysis.
cut points
Use in Exploratory Data Analysis.
cumulative distribution
Use in Exploratory Data Analysis.
References and provenance
Safavi (2026), Chapter 7. Student notes: Mohammad Safavi, Ph.D., STATLAB Academy, Version 1.0.
Resource
The authoritative 125-page English PDF accompanies this native lesson.
DownloadReflection
Name the assumption, evidence you would seek, and how the recommendation might change.
Exit check
Reach 70% to complete the chapter. Explanations appear after submission.
Checkpoint
Question 1 of 2. Answered 0/2. Passing score: 70%.