library(tidyverse)
library(simr)
planned_data <-
expand_grid(
hospital = 1:30, # 30 hospitals (Level 2)
patient = 1:10 # 10 patients per hospital (Level 1)
) |>
mutate(
# Assign the first half to treatment and second half to control
treatment = if_else(hospital <= 15, true = 1, false = 0),
hospital = factor(hospital)
)
