Constrained Optimal Sample Allocation Tutorial

Metin Bulus

2018-03-01

The following example demonstrates how to perform constrained optimal sample allocation (COSA) for a two-level cluster randomized trial (CRT) and for a corresponding cluster-level regression discontinuity (CRD) design. Number of clusters is calculated where treatment and control units are associated with differential marginal costs. This result in a cost-efficient treatment group allocation (p) for the CRT along with the optimal number of clusters. However, in a comparable CRD design proportion of treatment group allocation cannot be optimized as the cutoff and the scoring variable is predetermined.

Cluster Randomized Trial (CRT)

# cost constrained - optimize p and n2
# Specifying rhots as 0 allows COSA in CRT
crt <- cosa.crd2r2(rhots = 0,
                   constrain = "cost", cost = 15000,
                   cn1 = c(5, 2), cn2 = c(50, 20),
                   es = .20, rho2 = .20,
                   g2 = 5, r21 = .20, r22 = .30,
                   p = NULL, n1 = 24,  n2 = NULL)
## 
## Results are equivalent to corresponding random assignment designs 
## Solution converged with LBFGS 
##      [n1]  n2     p [cost]  es 95%lcl 95%ucl power
## [1,]   24 140 0.386  15028 0.2   0.06   0.34   0.8

Cluster-level Regression Discontinuity (CRD) Study

# cost constrained - optimize n2
crd <- cosa.crd2r2(constrain = "cost", cost = 15000,
                   cn1 = c(5, 2), cn2 = c(50, 20),
                   es = .20, rho2 = .20,
                   g2 = 5, r21 = .20, r22 = .30,
                   p = .387, n1 = 24,  n2 = NULL)
## Solution converged with LBFGS 
##      [n1]  n2   [p] [cost]    es 95%lcl 95%ucl power
## [1,]   24 140 0.386  15028 0.324  0.097   0.55  0.41

Comparison via MDES and Power Plots

par(mfrow = c(1, 2), mai = c(1, .9, .5, .2))

plot(crt, ypar = "mdes", xpar = "n2",
     ylim = c(0, 1), xlim = c(10, 200), 
     ylab = "MDES (Power = .80)", xlab = "Number of Clusters",
     main = "CRT", locate = TRUE)
plot(crd, ypar = "mdes", xpar = "n2",
     ylim = c(0, 1), xlim = c(10, 200),
     ylab = "MDES (Power = .80)", xlab = "Number of Clusters",
     main = "CRD", locate = TRUE)

plot(crt, ypar = "power", xpar = "n2",
     ylim = c(0, 1), xlim = c(10, 200), 
     ylab = "Power (ES = .20)", xlab = "Number of Clusters",
     main = "CRT", locate = TRUE)
plot(crd, ypar = "power", xpar = "n2",
     ylim = c(0, 1), xlim = c(10, 200), 
     ylab = "Power (ES = .20)", xlab = "Number of Clusters",
     main = "CRD", locate = TRUE)

–o–