In this assignment sequence, you will analyze data about newborn babies and their mothers. The dataset includes information such as birth weight, gestation length, maternal age, maternal height and weight, smoking status, and previous pregnancy history.
We will return to this same dataset across several chapters. Each time, you will use a different statistical tool to answer a different kind of research question.
The goal is not simply to run R code. The goal is to practice the full statistical reasoning workflow:
Research question → variables → visualization → analysis choice → results → interpretation → limitations
What factors are associated with a baby’s birth weight?
Different statistical methods help us answer different versions of this question:
| Variable | Meaning | Type |
|---|---|---|
bwt |
Baby’s birth weight in ounces | Quantitative |
gestation |
Length of pregnancy in days | Quantitative |
par_bi |
Whether the mother has given birth before; 0 =
first-time mother, 1 = has given birth before |
Categorical |
age |
Mother’s age in years | Quantitative |
age_group |
Mother’s age category; 1 = teens, 2 = 20s,
3 = 30s+ |
Categorical |
height |
Mother’s height in inches | Quantitative |
weight |
Mother’s weight in pounds | Quantitative |
smoke |
Smoking status during pregnancy; 0 = no, 1
= yes |
Categorical |
Every assignment in this sequence begins with the same setup. Run this at the top of every script before anything else.
# Load the dataset
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)
# Binary versions used in the analyses (drop ambiguous categories)
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))See Chapter 7 for a full explanation of why each step matters.
This dataset can help us examine relationships and group differences. However, most of the analyses in this assignment are observational.
Use cautious language:
Smoking status was associated with birth weight in this dataset.
Avoid unsupported causal language:
Smoking caused lower birth weight.
Even if a result is statistically significant, we still need to consider possible confounding variables, measurement issues, sample size, practical importance, and study design.
Every analysis in this sequence reports an effect size. Effect sizes are reported regardless of whether a result is statistically significant — the magnitude of an effect matters whether or not it clears an arbitrary threshold.
| Analysis | Effect size to report |
|---|---|
| Correlation | r (already the effect size) |
| Simple regression | R² |
| Independent t-test | Cohen’s d |
| One-way ANOVA | η² (eta-squared) |
| Multiple regression | R², adjusted R² |
Good uses of AI:
Poor uses of AI:
You are responsible for identifying the variables, choosing the analysis, interpreting the output, and explaining what can and cannot be concluded.
Each Baby Dataset assignment follows this structure: