######################################################################################
######################## Reproducibility Code in R and Python ########################
######################################################################################
The following code is designed to reproduce all the calculated results from Baird et al., as well as provide flexible functions for calculating and optimizing power.
The functions power_ind, power_pooled, and power_slope define functions according to Theorems 1-3, used in the calculations for the paper. The functions Compass_Search and index_min can be used to optimize power over a range of saturation values and weights using the Compass Search algorithm and brute force, respectively. Further detail is provided in the code. Following the definition of these functions are the requisite calculations to reproduce Tables 1 and 2 in the paper, which provide several examples of optimizations allowed by these functions. The code uses the Compass Search algorithm, with the brute force analog commented out for each section.
This code only requires that R or Python be installed. The Python code uses Numpy and Scipy, and the R code uses no special libraries. The code requires negligible RAM (<1 MB), and takes approximately 15 seconds to complete all calculations in the paper. Calculations are accurate to within 5 significant digits; further accuracy can be specified with negligible cost to computational time or resources.
For any questions, feel free to contact Patrick Staples at ctphoenix@gmail.com.