# Statistics Lab / ferdo — synthetic data (no real student records)
# Save stats_synthetic.csv in your working directory.
d <- read.csv("stats_synthetic.csv", stringsAsFactors = TRUE)
stopifnot(nrow(d) == 36, all(c("score_pre","score_post","group") %in% names(d)))
# Groups are observational labels: differences cannot establish a treatment effect.

d <- read.csv("stats_synthetic.csv")
n <- sum(!is.na(d$score_post))
xbar <- mean(d$score_post)
se <- sd(d$score_post) / sqrt(n)
c(mean=xbar, standard_error=se)
t.test(d$score_post)$conf.int
# Inferential validity still depends on the data-generating process.
