# Simulated example data (two groups, simple outcome)
set.seed(42)
n <- 400
simdat <- tibble(
group = sample(c("Control", "Treatment"), n, TRUE),
x = rnorm(n),
y = 0.4 * (group == "Treatment") + 0.6 * x + rnorm(n, sd = 0.8)
)
# A small model for diagnostic plots later
mod <- lm(y ~ x + group, data = simdat)
simdat$.fitted <- fitted(mod)
simdat$.resid <- resid(mod)
# Penguins subset (complete cases)
peng <- penguins |>
select(species, island, bill_length_mm, bill_depth_mm, body_mass_g, flipper_length_mm, sex) |>
drop_na()











