Skip to contents

Compute a stratified CMR allocation from a supplied cell-level variance rectangle.

Usage

cmr_stratified_from_rectangle(
  rectangle,
  strata_share,
  control = list(),
  max_vertices = 65536L
)

Arguments

rectangle

Stratified variance rectangle, a list with lower and upper 2 x S matrices.

strata_share

Named stratum population shares that sum to one.

control

Optional list of solver controls for the general vertex epigraph solver.

max_vertices

Maximum number of hyperrectangle vertices to enumerate.

Value

A list of class cmr_stratified with assignment shares pi, pi_matrix, stratum sampling margins, within-stratum treatment margins, CMR certificate U_CMR, checked rectangle, vertex diagnostics, and solver diagnostics.

Examples

strata_share <- c(A = 0.4, B = 0.6)
rect <- list(
  lower = rbind(treatment = c(A = 0.01, B = 0.04),
                control = c(A = 0.02, B = 0.03)),
  upper = rbind(treatment = c(A = 0.08, B = 0.12),
                control = c(A = 0.09, B = 0.10))
)
cmr_stratified_from_rectangle(rect, strata_share)
#> <cmr_stratified>
#>   pi: 1:A=0.161469, 0:A=0.186198, 1:B=0.344152, 0:B=0.30818
#>   U_CMR: 0.02525