30  Case Study: The Babies Dataset

NoteWhat you’ll be able to do

By the end of this chapter you will be able to:

  1. Carry a real observational dataset through the full workflow: prepare, describe, check normality, test, model.
  2. Choose the right test for each question as it arises — not because the chapter told you which one.
  3. Interpret smoking-and-birth-weight results within the limits of observational data.
  4. Combine predictors in a multiple regression and interpret the result.

The Babies dataset is the workhorse case study for this course. It contains birth-weight data for 1,236 infants along with maternal characteristics — exactly the kind of observational data where the full toolkit of t-tests, regression, normality checking, and transformations all come into play.

This chapter walks through the analyses you’d do with this dataset, using the techniques from Parts III–V.

30.1 The dataset

Each row is one infant. The variables typically include:

Variable Description Type
bwt Birth weight in ounces Numeric (continuous)
gestation Gestation length in days Numeric (continuous)
age Mother’s age in years Numeric (continuous)
height Mother’s height in inches Numeric (continuous)
weight Mother’s weight in pounds Numeric (continuous)
smoke_bi Smoking status (0 = never smoked, 1 = currently smokes) Factor (dichotomous)

The outcome of interest is usually bwt (birth weight). The most-asked question: is maternal smoking associated with lower birth weight, controlling for other relevant variables?

ImportantData provenance and the limits of observational evidence

The Babies dataset is drawn from observational birth-records data collected at Kaiser Permanente in Oakland, CA, in the late 1950s and 1960s. Jacob Yerushalmy’s work in this era was among the first to quantify the association between maternal smoking and birth weight.

Because women were not randomly assigned to smoking status, the design is observational. The smoking–birth weight association has been replicated in many independent samples over six decades, which substantially strengthens the causal case — but this dataset alone demonstrates association, not causation. The smoke_bi variable is also binary (yes/no) and does not capture amount, timing, or type of tobacco use.

When writing up your analysis, be precise: babies of smokers had significantly lower birth weights is supported by the data. Smoking caused lower birth weight requires the broader evidence base — not just this dataset.

30.2 Setup: load and prepare the data

Load and clean the Babies dataset using the same steps as Chapter 7, then alias it to data so the code below reads cleanly:

library(UsingR)
data(babies)

# Recode missing values and create clean, clearly-named columns
babies$bwt       <- ifelse(babies$wt == 999, NA, babies$wt)
babies$gestation <- ifelse(babies$gestation == 999, NA, babies$gestation)
babies$age       <- ifelse(babies$age == 99, NA, babies$age)
babies$height    <- ifelse(babies$ht == 99, NA, babies$ht)
babies$weight    <- ifelse(babies$wt1 == 999, NA, babies$wt1)
babies$smoke     <- ifelse(babies$smoke == 9, NA, babies$smoke)
babies$smoke_bi  <- as.factor(ifelse(babies$smoke %in% c(0, 1), babies$smoke, NA))
babies$par_bi    <- as.factor(ifelse(babies$parity == 0, 0, 1))
babies$age_group <- cut(babies$age, breaks = c(0, 19, 29, 99), labels = c(1, 2, 3))

data <- babies   # alias used throughout this chapter

The smoking analyses compare current smokers with never-smokers: the 198 former smokers (and 10 unknowns) are NA in smoke_bi, so the t-test below uses 1,028 babies. Each analysis also drops babies missing any variable it uses (1,200 in the weight regression, 986 in the full model). Read the “observations deleted” line in every summary().

30.3 Question 1: What does birth weight look like?

Start with EDA before any test.

str(data)
summary(data)

# Visualize the distribution
hist(data$bwt, breaks = 25)
boxplot(data$bwt ~ data$smoke_bi,
        main = "Birth weight by smoking status",
        xlab = "Smoke (0 = never, 1 = current)",
        ylab = "Birth weight (oz)")

Birth weights typically look approximately normal — a key contrast with reaction-time data, which tends to be right-skewed.

30.4 Question 2: Is birth weight normally distributed?

shapiro.test(data$bwt)
qqnorm(data$bwt); qqline(data$bwt, col = "red")

Usually bwt passes Shapiro-Wilk or is close enough to normal that no transformation is needed. The dataset is also large enough (\(n\) in the hundreds) that minor non-normality doesn’t matter — t-tests and regression are robust at this sample size (Chapter 10).

If bwt were right-skewed, the natural transformation would be log(bwt) (Chapter 12).

30.5 Question 3: Do smokers have lower-birth-weight babies?

This is the headline analysis. With a continuous outcome (bwt) and a dichotomous predictor (smoke_bi), the test is an independent-samples t-test.

# smoke_bi is already a factor from the setup step

# Normality per group
tapply(data$bwt, data$smoke_bi, shapiro.test)

# Welch's t-test (default)
t.test(bwt ~ smoke_bi, data = data)

# Effect size
library(effsize)
cohen.d(bwt ~ smoke_bi, data = data)

# Descriptives
aggregate(bwt ~ smoke_bi, data = data, FUN = mean)
aggregate(bwt ~ smoke_bi, data = data, FUN = sd)

In the published version of this dataset, the answer is consistently yes: smokers’ babies weigh significantly less than non-smokers’ babies, by roughly 8 ounces on average, with a medium effect size.

An independent-samples Welch’s t-test indicated that babies of smokers (M = 114.1, SD = 18.1) had significantly lower birth weights than babies of never-smokers (M = 122.8, SD = 17.1), t(996.21) = 7.86, p < .001, Cohen’s d = 0.49 (medium effect), 95% CI for the mean difference [6.51, 10.83].

30.6 Question 4: Does mother’s weight predict birth weight?

This is a simple regression with a continuous predictor.

model <- lm(bwt ~ weight, data = data)
summary(model)

# Visualize
library(ggplot2)
ggplot(data, aes(x = weight, y = bwt)) +
  geom_point(alpha = 0.4) +
  geom_smooth(method = "lm", se = TRUE)

# Diagnostics
par(mfrow = c(2, 2)); plot(model); par(mfrow = c(1, 1))

The slope is typically small but significant: heavier mothers tend to have slightly heavier babies. The \(R^2\) is modest because birth weight depends on many things besides mother’s weight.

30.7 Question 5: Combining predictors

The interesting analysis is multiple regression: how much of birth-weight variance can we explain when we include several predictors at once?

model_full <- lm(bwt ~ weight + gestation + smoke_bi + age, data = data)
summary(model_full)
confint(model_full)
library(car)
vif(model_full)

Typical findings:

  • gestation is the strongest single predictor (longer gestation, heavier baby) — unsurprisingly.
  • smoke remains significant after controlling for gestation, weight, and age — the smoking effect is robust.
  • weight is a modest positive predictor.
  • age is often a weak or non-significant predictor on its own; with collinearity in real data, results vary.
  • VIF values are typically low (well under 5) — the predictors don’t have major multicollinearity issues.

A multiple regression indicated that gestation, smoking status, mother’s weight, and age together explained 22% of the variance in birth weight (N = 986), F(4, 981) = 69.32, p < .001, \(R^2\) = .22. Smoking remained a significant negative predictor, b = −7.86, SE = 1.04, 95% CI [−9.89, −5.83], t(981) = −7.59, p < .001, after controlling for the other variables.

30.8 Question 6: When does normality matter for this dataset?

Worth noting: the Baby Dataset is large enough (hundreds of observations) that normality matters very little for the t-tests and regression. The Central Limit Theorem provides robustness. The Shapiro-Wilk checks are pedagogically important — students should learn the workflow — but in practice the answer would be the same with or without strict normality.

This is a useful contrast with smaller datasets where assumption violations actually drive different conclusions.

TipSuggested student workflow

Across two or three lab sessions, a student should:

  1. EDA on bwt (histograms, boxplots, descriptives)
  2. Normality check
  3. Independent t-test on bwt ~ smoke_bi
  4. Simple regression on bwt ~ gestation
  5. Multiple regression on bwt ~ smoke_bi + gestation + weight + age
  6. Diagnostic plots
  7. Full APA write-up

This sequence combines assumption checks, an independent-samples t-test, and regression from Parts III–V.

The next case study takes a smaller, more open-ended dataset and shows what EDA looks like when the question isn’t pre-defined.


TipChapter Summary

Core idea: One real observational dataset carried through the entire workflow — prepare, describe, check normality, test, model, diagnose, report. Several tools from Parts III–V work together on the same data.

You should understand:

  • Why each question dictated its test: group comparison → t-test; continuous predictor → regression; several predictors → multiple regression
  • What observational data permit you to conclude about smoking and birth weight — an association consistent with other evidence, not an experiment
  • When normality actually mattered for this dataset, and when sample size made it a non-issue

You should be able to do in R:

  • Run the standard babies prep script and verify smoke_bi, par_bi, age_group
  • Move from t.test() to lm() to multi-predictor lm() on the same outcome
  • Check the regression with diagnostic plots before reporting it

Plain-language check: Smokers’ babies weigh less in this dataset. Why can’t this analysis alone establish that smoking causes lower birth weight — and what kind of evidence strengthens the causal case?

The one mistake to avoid: Jumping straight to the t-test. The EDA and normality steps are what make the test’s result trustworthy.

Practice: Add gestation to the smoking model. Does the smoking coefficient change? What does that tell you?

Key terms from this chapter are defined in the Glossary.