Bound Constrained Optimal Sample Allocation

Implements bound constrained optimal sample allocation (BCOSA) framework described in Bulus & Dong (2019) for power analysis of multilevel regression discontinuity designs (MRDDs) and multilevel randomized trials (MRTs) with continuous outcomes. Separate tools for statistical power and minimum detectable effect size computations are provided.


cosa implements (generalized) bound constrained optimal sample allocation framework for multilevel regression discontinuity designs (RDDs) and multilevel randomized controlled trials (CRTs) with continuous outcomes. COSA functions are designed to optimize proportion of treatment allocation (p) and sample size (generically, n) at one or more levels subject to budget, statistical power, or effect size constraints along with constraints on n and p. Constraints on n and p can be in the form of fixed values or bound constraints (aka box constraints).

Note: n and p should be omitted (or specified as NULL) for optimization. p can only be optimized (or bound constrained) in multilevel randomized trials when treatment and control units have differing costs. When the primary constraint is on statistical power or effect size providing marginal cost information will result in an cost-efficient sample allocation. When marginal cost information is not provided different starting values and algorithms may produce different results especially when sample sizes at two or more levels and p are optimized. Comparing several algorithms and starting values may faciliate decisions regarding sample sizes and p.

To install and load the package:

install.packages("cosa")
library(cosa)

Constrained optimal sample allocation in cluster-level regression discontinuity study where discontinuity resides at level 3:

# cost constrained - optimize n1 and n3
rdd <- cosa.crd3r3(constrain = "cost", cost = 30000,
                   cn1 = 5, cn2 = 10, cn3 = c(50, 20),
                   es = .20, rho2 = .20, rho3 = .10,
                   g3 = 1, r21 = .20, r22 = .30, r23 = .40,
                   p = .40, n1 = NULL, n2 = 3, n3 = NULL)
summary(rdd)
plot(rdd)

Specifying rhots = 0 produces result equivalent to corresponding random assignment design where also p can be optimized. rhots = 0 means there is no relationship between the treatment [random] and the score variable. Constrained optimal sample allocation in three-level cluster randomized trial where treatment resides at level 3:

# cost constrained - optimize p, n1, n3
crt <- cosa.crd3r3(rhots = 0, constrain = "cost", cost = 30000, 
                   cn1 = 5, cn2 = 10, cn3 = c(50, 20),
                   es = .20, rho2 = .20, rho3 = .10,
                   g3 = 1, r21 = .20, r22 = .30, r23 = .40,
                   p = NULL, n1 = NULL, n2 = 3, n3 = NULL)
summary(crt)
plot(crt)

--o--
Copyright © 2017-2018 Metin Bulus

News

Changes in the cosa 1.2.1

  • Experimental wrapper functions cosa(), mdes() and power() removed
  • Summaries are printed with the function call
  • Allow users to specify benchmark value in the plots
  • Title changed

Changes in the cosa 1.2.0

  • Jacobians added
  • Option for maximizing power when primary constraint is placed on the total cost
  • Bug fixes for cosa.bird2r1() function

Changes in the cosa 1.1.0

  • Experimental wrapper functions cosa(), mdes() and power() added
  • Designs with top-level stratification (fixed blocks) added
  • Bug fixes for bcrd4r2 and bcrd4r3 designs
  • S3 plot() methods added
  • Validity checks for arguments improved
  • Citation added

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("cosa")

2.0.0 by Metin Bulus, 3 months ago


Browse source code at https://github.com/cran/cosa


Authors: Metin Bulus [aut, cre] , Nianbo Dong [aut]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports nloptr, msm

Suggests knitr, rmarkdown


See at CRAN