#!/usr/bin/env Rscript # Copyright 2026 Mike Hammes. SPDX-License-Identifier: Apache-2.0 # T1 material specification 1.0. Fixed before the first data generation. # Usage: Rscript scripts/generate-learning-study.R path/to/new.csv # Refuses replacement. No seed search, clipping, rounding or resampling. args <- commandArgs(trailingOnly = TRUE) if (length(args) != 1L) stop("Supply one new CSV output path") if (file.exists(args[[1L]])) stop("Refusing to replace existing data") RNGkind("Mersenne-Twister", "Inversion", "Rejection") set.seed(20260918) id <- 1:80 condition <- sample(rep(c("practice", "rereading"), each = 40)) u <- rnorm(80, 0, 0.5) p <- plogis(qlogis(0.62) + 0.28 * (condition == "practice") + u) score <- rbinom(80, size = 100, prob = p) data <- data.frame(id, condition, score) data <- data[order(match(data$condition, c("practice", "rereading")), data$id), ] stopifnot(nrow(data) == 80L, !anyNA(data), !anyDuplicated(data$id), all(table(data$condition) == 40L), all(data$score %in% 0:100)) write.table(data, args[[1L]], sep = ",", row.names = FALSE, col.names = TRUE, quote = TRUE, na = "NA", eol = "\n", fileEncoding = "UTF-8") cat("Created 80 synthetic participants; fixed seed 20260918.\n")