strata_data <- table(data.frame(
"f1" = sample(c(TRUE, FALSE), 100, TRUE),
"f2" = sample(c("x", "y", "z"), 100, TRUE),
stringsAsFactors = TRUE
))
ns <- colSums(strata_data)
ests <- strata_data["TRUE", ] / ns
vars <- ests * (1 - ests) / ns
weights <- rep(1 / length(ns), length(ns))
strata_normal_quantile(vars, weights, 0.95)
Run the code above in your browser using DataLab