tau <- 0.1
design <-
declare_model(
clusters = add_level(N = 100, prob = runif(N, min = 0, max = 0.9), prob = if_else(prob < 0.2, 0, prob)),
people = add_level(N = 10)
) +
declare_model(
potential_outcomes(bin ~ draw_binary_icc(prob = prob * (1 + Z * tau), clusters = clusters, ICC = 0.1))
)
design |> draw_data() |> group_by(zero = prob == 0) |> summarize(mean(bin_Z_0))
should have no 1's in the outcome in control when prob is 0 but it has lots
Need to handle prob of length N (or at minimum error if not)