fev <- read.table("../../data/fev1.txt", header = TRUE)
# Sample 15 children for clarity
set.seed(667)
ids <- sample(unique(fev$id), 15)
fev_sub <- fev[fev$id %in% ids, ]
ggplot(fev_sub, aes(x = age, y = logfev1, group = id, color = factor(id))) +
geom_line(linewidth = 0.8) +
geom_point(size = 2) +
theme_minimal() +
theme(legend.position = "none") +
labs(title = "Lung Function Trajectories (15 Children)",
x = "Age (years)", y = "log(FEV1)")