Exercise: Buy more participants or more trials?#
A paired experiment has a fixed budget. Determine whether increasing trials or participants better supports detection and precision when people differ in their treatment effects.
See the shared submission guidance and rubric. Run from book/exercises; the setup below supplies data, not completed answers.
# Shared simulator and small utility functions; no live service is called.
source("../R/course.R")
designs <- expand.grid(participants=c(20,40,80), trials=c(5,20))
true_effect <- -15
person_effect_sd <- 30
trial_difference_sd <- 60
# Each person's averaged paired difference has both sources of variation.
simulate_differences <- function(n,trials,delta) {
rnorm(n,delta,person_effect_sd) + rnorm(n,0,trial_difference_sd/sqrt(trials))
}
set.seed(119)
1. Specify the design decision#
For each design, calculate cost = 100participants + 5participants*trials. Set a budget of 8000. Explain the two variance terms and why repeating trials cannot eliminate person-to-person variation in effects. Specify a two-sided paired-difference t-test at alpha=.05.
# Add cost and budget eligibility columns.
Your explanation and evidence:
2. Estimate operating characteristics#
Run 500 experiments per design under delta=-15. Record rejection, 95% interval coverage of -15, and interval width. Report power, coverage, mean width, and Monte Carlo SEs for the two proportions. Repeat at delta=0 to estimate false-positive rates. Do not call coverage a power estimate.
# Use t.test on simulated person differences and retain one row per experiment.
Your explanation and evidence:
3. Recommend a budget-feasible design#
Compare eligible designs using power and precision, including Monte Carlo uncertainty. Repeat your leading design with person_effect_sd=45. Explain how this sensitivity affects the recommendation and what pilot information would improve it; do not promise a guaranteed significant result.
# Summarize the design comparison and sensitivity scenario.
Your explanation and evidence:
What to submit#
A cost/operating-characteristics table, a power or interval-width plot, and a budget recommendation grounded in the assumed variance components.