In Bayesian statistics, the marginal likelihood (ML) is the key ingredient needed for model comparison and model averaging. Unfortunately, estimating MLs accurately is notoriously difficult, especially for models where posterior simulation is not possible. Recently, Christensen (2023) introduced the concept of permutation counting, which can accurately estimate MLs of models for exchangeable binary responses. Such data arise in a multitude of statistical problems, including binary classification, bioassay and sensitivity testing. Permutation counting is entirely likelihood-free and works for any model from which a random sample can be generated, including nonparametric models. Here we present perms, a package implementing permutation counting. As a result of extensive optimisation efforts, perms is computationally efficient and able to handle large data problems. It is available as both an R package and a Python library. A broad gallery of examples illustrating its usage is provided, which includes both standard parametric binary classification and novel applications of nonparametric models, such as changepoint analysis. We also cover the details of the implementation of perms and illustrate its computational speed via a simple simulation study.
翻译:在贝叶斯统计中,边际似然是模型比较和模型平均的关键要素。然而,精确估计边际似然通常极为困难,尤其对于无法进行后验模拟的模型而言。近期,Christensen (2023) 提出了置换计数方法,能够精确估计可交换二元响应模型中的边际似然。此类数据广泛存在于包括二分类、生物测定及灵敏度测试在内的多种统计问题中。置换计数方法完全无需似然函数,适用于任何可生成随机样本的模型(包括非参数模型)。本文介绍perms这一实现置换计数的软件包。通过大量优化工作,perms具有高效的计算性能,可处理大规模数据问题。该软件包同时提供R包和Python库两种形式。我们提供了涵盖标准参数化二分类及非参数模型创新应用(如变点分析)的丰富示例展示其用法。此外,还详述了perms的实现细节,并通过简单仿真研究验证其计算效率。