Appendix E: The Datasets of This Book
MATH 4210 -- source, variables, story, and chapters for every dataset
Every dataset in this book lives in data/ as a CSV, readable the same way in R
(read.csv("data/<file>.csv")) and Python (pandas.read_csv("data/<file>.csv")). No file
contains invented values: each one is exported from a locally installed, citable R package,
transcribed from the ALRM textbook and checked against its printed output, or downloaded fresh
from the dataset’s official public source. Entries below are alphabetical by file name. Each
entry gives the story, the provenance, the variables, the sample size, and the chapters that
use the file.
advertising.csv¶
Story. Two hundred markets’ advertising budgets across three media (TV, radio, newspaper) and the sales that followed: the standard “does advertising spend predict sales, and does each medium matter” example.
Provenance. James, Witten, Hastie & Tibshirani, An Introduction to Statistical
Learning; official companion data, downloaded from
https://trevorhastie.github.io/ISLR/Advertising.csv and checked row for row against the
published table.
Variables. TV, radio, newspaper (ad budgets, thousands of dollars), sales
(thousands of units).
n = 200.
Chapters. 3.
airpassengers.csv¶
Story. The classic Box-Jenkins airline series: monthly international passenger counts with trend and strong seasonality, the standard illustration for regression with trend and seasonal dummies.
Provenance. Base R datasets::AirPassengers (Box, Jenkins & Reinsel, Time Series
Analysis: Forecasting and Control, 3rd ed.), reshaped from its native monthly ts object
into a tidy long-format table.
Variables. year (1949 to 1960), month (1 to 12), passengers (monthly total, thousands).
n = 144.
Chapters. 15.
anscombe.csv¶
Story. Four x-y datasets with nearly identical means, variances, correlations, and fitted regression lines, yet completely different shapes when plotted: the founding argument for always plotting your data.
Provenance. Base R datasets::anscombe (Anscombe, F. J. (1973), “Graphs in Statistical
Analysis,” The American Statistician, 27(1), 17 to 21).
Variables. x1, x2, x3, x4, y1, y2, y3, y4 (unitless), kept in the textbook’s original
wide format: four separate x-y pairs sharing one table.
n = 11.
Chapters. 1, 4.
bodyfat3.csv¶
Story. Twenty men’s body fat percentage, measured by underwater weighing, against three easy-to-measure skinfold and circumference readings: the running example for extra sums of squares.
Provenance. Transcribed by hand from Kutner, Nachtsheim & Neter, Applied Linear
Regression Models, 4th ed. (“ALRM”), Table 7.1. Refit in R and checked against ALRM’s own
Table 7.2: lm(bodyfat ~ triceps) and lm(bodyfat ~ thigh) matched the book’s coefficients,
standard errors, and sums of squares exactly, and lm(bodyfat ~ triceps + thigh) matched the
book’s extra-sum-of-squares calculation SSR(X2|X1) = 33.17 exactly.
Variables. triceps (triceps skinfold thickness, mm), thigh (thigh circumference, cm),
midarm (midarm circumference, cm), bodyfat (percent body fat).
n = 20.
Chapters. 8.
cars.csv¶
Story. Stopping distance grows faster than linearly with speed, and the scatter widens as speed increases: the standing example both for polynomial regression and for nonconstant error variance.
Provenance. Base R datasets::cars (Ezekiel, M. (1930), Methods of Correlation
Analysis, Wiley). Data recorded in the 1920s.
Variables. speed (mph), dist (stopping distance, ft).
n = 50.
Chapters. 10 (heteroscedasticity and weighted least squares), 11 (polynomial regression).
duncan.csv¶
Story. Forty-five U.S. occupations circa 1950, prestige rated by survey against income and education: a classic path-analysis dataset, with income and education as parallel routes to prestige.
Provenance. carData::Duncan (installed with the car package). Duncan, O. D. (1961), “A
socioeconomic index for all occupations,” in Reiss (ed.), Occupations and Social Status,
Free Press.
Variables. occupation (name), type (prof professional/managerial, wc
white-collar, bc blue-collar), income (percent of incumbents earning $3,500 or more in the
1950 US Census), education (percent high school graduates), prestige (percent of survey
respondents rating the occupation “good” or better).
n = 45.
Chapters. 16.
dwaine.csv¶
Story. A portrait-studio chain deciding whether to expand into new cities, using each city’s under-16 population and disposable income to predict studio sales: the book’s running worked example for multiple regression in matrix form.
Provenance. Transcribed from ALRM 4e, Figure 6.5b, the Dwaine Studios example, read
directly from a rendered page image to avoid a column-alignment artifact in the PDF’s text
layer. Refit in R: lm(sales ~ targtpop + dispoinc) matched ALRM equation (6.76) to all four
decimal places, and every intermediate column sum matched the book’s printed values to
rounding.
Variables. targtpop (population aged 16 or younger, thousands of persons), dispoinc
(per-capita disposable income, thousands of dollars), sales (thousands of dollars).
n = 21.
Chapters. 6, 7, 8.
fat.csv¶
Story. Two hundred fifty-two men’s body fat, measured precisely by underwater weighing, against age, weight, height, and ten easy tape-measure circumferences: the course’s many-correlated-predictors case for variable selection, multicollinearity diagnostics, and validation by a train/test split.
Provenance. faraway::fat. Johnson, R. (1996), “Fitting Percentage of Body Fat to Simple
Body Measurements,” Journal of Statistics Education, 4(1).
Variables. brozek, siri (percent body fat, two formulas), density (g/cm^3), age
(yrs), weight (lbs), height (in), adipos (adiposity index, kg/m^2), free (fat-free
weight, lbs), and nine circumferences in cm: neck, chest, abdom, hip, thigh, knee,
ankle, biceps, forearm, wrist.
n = 252.
Chapters. 12.
gala.csv¶
Story. Plant species counts on 30 Galapagos islands against geographic predictors: a compact, real dataset where several diagnostics fire at once, including a high-leverage point for one dominant outlier island. Revisited three times: leverage points, then transformation, then Poisson regression.
Provenance. faraway::gala. Johnson, M. P. and Raven, P. H. (1973), “Species number and
endemism: The Galapagos Archipelago revisited,” Science, 179, 893 to 895.
Variables. island (name), Species (number of plant species), Endemics (number of
endemic species), Area (km^2), Elevation (highest elevation, m), Nearest (distance to
nearest island, km), Scruz (distance to Santa Cruz island, km), Adjacent (area of adjacent
island, km^2).
n = 30.
Chapters. 9, 10, 14.
galton_heights.csv¶
Story. The dataset that gave “regression” its name: children’s heights plotted against a weighted average of their parents’ heights, tending back toward the population mean.
Provenance. HistData::GaltonFamilies. Galton, F. (1886), “Regression Towards Mediocrity
in Hereditary Stature,” Journal of the Anthropological Institute, 15, 246 to 263; digitized
and transcribed by Beverley Shipley (2001).
Variables. family (family ID), father, mother (parent heights, in), midparentHeight
(= (father + 1.08 mother)/2, in), children (family size), childNum, gender,
childHeight (in).
n = 934.
Chapters. 1, 4.
mammals.csv¶
Story. Brain weight against body weight across 62 land mammal species, spanning many orders of magnitude: the standard log-log transformation example, where a straight line only appears after taking logs of both variables.
Provenance. MASS::mammals. Weisberg, S. (1985), Applied Linear Regression, 2nd ed.,
Wiley, selected from Allison, T. and Cicchetti, D. V. (1976), “Sleep in mammals: ecological
and constitutional correlates,” Science, 194, 732 to 734.
Variables. species (common name), body (body weight, kg), brain (brain weight, g).
n = 62.
Chapters. 10 (log-log transformation).
orings.csv¶
Story. O-ring thermal distress against launch temperature on the 23 shuttle flights before the Challenger disaster, which launched at 31 degrees F, far below any prior flight: the course’s logistic regression hook, previewed once and resolved once.
Provenance. faraway::orings. Presidential Commission on the Space Shuttle Challenger
Accident, Vol. 1 (1986), pp. 129 to 131.
Variables. temp (launch temperature, deg F), damage (number of O-ring damage
incidents, out of 6 possible).
n = 23.
Chapters. 1 (preview), 13.
pima.csv¶
Story. A clinical diabetes screening study: the course’s second logistic regression example, with a well-known data-quality wrinkle (physiologically impossible zeros in several predictors) that becomes a diagnostics teaching point.
Provenance. faraway::pima. National Institute of Diabetes and Digestive and Kidney
Diseases study of Pima Indian women near Phoenix, AZ; distributed via the UCI Machine Learning
Repository.
Variables. pregnant (times pregnant), glucose (plasma glucose, 2-hr oral glucose
tolerance test), diastolic (blood pressure, mm Hg), triceps (skinfold thickness, mm),
insulin (2-hr serum insulin, mu U/ml), bmi (kg/m^2), diabetes (diabetes pedigree function
score), age (yrs), test (0 = negative, 1 = positive for diabetes).
n = 768.
Chapters. 13.
punting.csv¶
Story. Thirteen college football punters’ leg strength and flexibility measured against how far and how long they can punt a football: a genuinely small sample, which is exactly why it anchors the permutation-test chapter, where classical normal-theory assumptions are the least trustworthy.
Provenance. faraway::punting.
Variables. Distance (average distance over 10 punts, ft), Hang (hang time, sec),
RStr, LStr (right/left leg strength, lbs), RFlex, LFlex (right/left hamstring
flexibility, degrees), OStr (overall leg strength, ft-lbs).
n = 13.
Chapters. 5.
salaries.csv¶
Story. Faculty salaries by rank, discipline, experience, and sex: the salary-equity worked example for dummy coding and the interaction between a categorical and a continuous predictor.
Provenance. carData::Salaries. Fox, J. and Weisberg, S. (2019), An R Companion to
Applied Regression, 3rd ed., Sage. 2008-09 salary data from a US college, collected to
monitor sex-based salary differences.
Variables. rank (AsstProf, AssocProf, Prof), discipline (A theoretical, B
applied), yrs.since.phd, yrs.service (years), sex (Female, Male), salary (9-month
academic salary, USD).
n = 397.
Chapters. 1 (preview), 11.
savings.csv¶
Story. Cross-country savings rates against demographic and income variables: the standard test bed for life-cycle savings theory (do young and old dependents each depress savings?), a compact, real, no-missing-data set used repeatedly across the correlation, multiple regression, and diagnostics chapters.
Provenance. faraway::savings (also distributed as datasets::LifeCycleSavings).
Belsley, D., Kuh, E. and Welsch, R. (1980), Regression Diagnostics, Wiley. Averaged over
1960 to 1970.
Variables. country (name), sr (aggregate personal savings rate, %), pop15 (% of
population under 15), pop75 (% of population over 75), dpi (per-capita disposable income,
USD), ddpi (% growth rate of dpi).
n = 50.
Chapters. 4, 8, 9, 10.
ships.csv¶
Story. Wave-damage incident counts for cargo ships by type, construction era, and operating period, with months of service as exposure: the course’s rate-data example for Poisson regression.
Provenance. MASS::ships. McCullagh, P. and Nelder, J. A. (1983), Generalized Linear
Models, Chapman & Hall, section 6.3.2.
Variables. type (ship type, A to E), year (year of construction, coded 60/65/70/75 for
1960-64/65-69/70-74/75-79), period (period of operation, coded 60 or 75 for 1960-74/1975-79),
service (aggregate months of service), incidents (number of damage incidents).
n = 40.
Chapters. 14.
strongx.csv¶
Story. A physics experiment measured a scattering cross-section at ten beam energies, each with its own known standard deviation. Because the precisions are known and unequal, this is the textbook example for weighted least squares with known weights, and adding a quadratic term reveals lack of fit in the straight-line model.
Provenance. faraway::strongx. Weisberg, S. (1985), Applied Linear Regression, 2nd ed.,
Wiley; the data come from a high-energy physics scattering experiment. Refit in R:
lm(crossx ~ energy, weights = 1/sd^2) reproduced Faraway’s published weighted-least-squares
coefficients.
Variables. momentum (incident particle momentum), energy (inverse beam energy, the
predictor used in the fit), crossx (measured scattering cross-section, the response), sd
(the known experimental standard deviation of crossx for that row).
n = 10.
Chapters. 10 (weighted least squares with known variances).
teengamb.csv¶
Story. A survey of teenage gambling in Britain. Not tied to a specific chapter, but available for supplementary data-analysis practice problems in any multiple-regression chapter.
Provenance. faraway::teengamb. Ide-Smith & Lea (1988), Journal of Gambling Behavior,
4, 110 to 118.
Variables. sex (0 = male, 1 = female), status (socioeconomic status score from
parents’ occupation), income (GBP/week), verbal (words correctly defined, out of 12),
gamble (gambling expenditure, GBP/year).
n = 47.
Chapters. None assigned; available for supplementary exercises.
toluca.csv¶
Story. The Toluca Company’s production-lot data: labor hours to produce a replacement part, by lot size. This is the course’s primary anchor dataset, threaded through simple linear regression, inference, the matrix approach, and permutation tests, and recalled again when diagnostics and Poisson regression need a familiar fit to check against.
Provenance. Transcribed from ALRM 4e, Table 1.1, the Toluca Company example. Refit in R:
lm(hours ~ lotsize) gives b0 = 62.366, b1 = 3.5702, matching the textbook’s own printed
fitted values, and R^2 = 0.8215, matching the book’s cited .822.
Variables. lotsize (production lot size, units), hours (labor hours).
n = 25.
Chapters. 1 (preview), 2, 3, 5, 7, 9 (recall), 14 (recall).
toluca_mini.csv¶
Story. A small enough slice of the Toluca data, n = 6, that a student can compute deviations, cross-products, b0, b1, and SSE entirely by hand, then check the answer against software on the full n = 25 dataset. This is the book’s hand-computation set.
Provenance. A seeded 6-row sample of toluca.csv, built with set.seed(4210) in R
(rows 6, 12, 15, 16, 24, 25 of the full 25-row file), fully reproducible from that seed.
Variables. lotsize, hours (same as toluca.csv).
n = 6.
Chapters. 2 (hand-computation exercises).