Planning empirical experiments such as clinical trials or A/B tests requires sample size determination, which in many interesting cases has no closed-form solution (e.g. factorial or adaptive designs). adsasi is a new R package that enables simulations-first sample size calculations for any trial that can be simulated in short compute time. First, the user specifies as a function that takes a sample size as argument, simulates the experiment, and returns a boolean for success/failure. Then, adsasi functions adsasi_0d and adsasi_1d iteratively call it on different sample sizes and progressively home in on the one with nominal success rate (power), assuming that increasing sample size increases power. adsasi_1d can also draw, purely empirically, the relationship between a design parameter and sample size. The implementation uses a modified probit regression (with success/failure as the dependent variable), informed by simulations conducted around the target size, and provides standard errors at each stage using the Cramér-Rao bound derived from a custom analytical Hessian matrix. Simple examples are first presented, yielding results within Monte Carlo variance of their closed-form expressions, then intractable ones (including bootstrapping from an existing medical cohort). adsasi will hopefully facilitate the funding and conduct of interesting, highly complex experimental designs by making their sizing straightforward.
翻译:规划实证实验(如临床试验或A/B测试)需要确定样本量,但在许多重要情形下(例如因子设计或自适应设计),该问题不存在闭合解。adsasi是一个新型R包,支持对任何可在短时间内完成模拟的实验进行基于仿真的样本量计算。用户首先需定义一个将样本量作为参数的函数,该函数模拟实验并返回表示成功/失败的布尔值。随后,adsasi函数adsasi_0d和adsasi_1d对不同样本量迭代调用该函数,逐步逼近具有名义成功率(统计功效)的样本量,其前提假设是增大样本量可提升统计功效。adsasi_1d还可纯粹基于经验数据绘制设计参数与样本量之间的关系曲线。该实现采用改进的probit回归(以成功/失败为因变量),并基于目标样本量附近进行的模拟提供信息,同时通过自定义解析Hessian矩阵导出Cramér-Rao界,为各阶段提供标准误差。本文首先展示简单示例,其结果与闭合解的蒙特卡洛方差吻合,随后处理复杂情形(包括基于现有医疗队列的bootstrap方法)。adsasi有望通过简化复杂实验设计的样本量计算过程,推动具有创新性且高度复杂的实验设计获得资助并顺利实施。