Journal of Open Research Software (Dec 2021)

bayesint: A Python Package for Calculating Bayesian Credible Intervals of Ratios of Beta Distributions

  • M. Bekker-Nielsen Dunbar,
  • Thomas J. R. Finnie

DOI
https://doi.org/10.5334/jors.283
Journal volume & issue
Vol. 9, no. 1

Abstract

Read online

We present 'bayesint', a Python package for calculating Bayesian credible intervals for ratios of two independent beta distributions such as are used when considering binomial data. Such data could be found in counts of events in medical diagnostic tests, case-control studies, and field epidemiological investigations, among other applications. The package contains general functions providing the expression of the density and distribution of the ratio and two functions for calculating the equal-tailed and highest posterior density credible intervals. The package is intended for use with 2×2 contingency tables. We introduce 'bayesint' by comparing two groups in a contingency table through calculating the relative risk of cholera, showcasing its use in a novel context.

Keywords