[Paper Review] BFpack: Flexible Bayes Factor Testing of Scientific Theories in R
BFpack is an R package that enables flexible Bayes factor hypothesis testing for common statistical models in social and behavioral sciences, supporting both exploratory (null vs. positive/negative effects) and confirmatory tests (with equality and order constraints). It integrates seamlessly with standard R modeling functions like lm, glm, and lmer, and provides interpretable Bayes factors and posterior probabilities even with missing data, offering a direct alternative to null hypothesis significance testing.
There has been a tremendous methodological development of Bayes factors for hypothesis testing in the social and behavioral sciences, and related fields. This development is due to the flexibility of the Bayes factor for testing multiple hypotheses simultaneously, the ability to test complex hypotheses involving equality as well as order constraints on the parameters of interest, and the interpretability of the outcome as the weight of evidence provided by the data in support of competing scientific theories. The available software tools for Bayesian hypothesis testing are still limited however. In this paper we present a new R-package called BFpack that contains functions for Bayes factor hypothesis testing for the many common testing problems. The software includes novel tools (i) for Bayesian exploratory testing (null vs positive vs negative effects), (ii) for Bayesian confirmatory testing (competing hypotheses with equality and/or order constraints), (iii) for common statistical analyses, such as linear regression, generalized linear models, (multivariate) analysis of (co)variance, correlation analysis, and random intercept models, (iv) using default priors, and (v) while allowing data to contain missing observations that are missing at random.
Motivation & Objective
- To address the growing need for Bayesian hypothesis testing in social and behavioral sciences that goes beyond traditional null hypothesis significance testing.
- To provide a user-friendly R package that computes Bayes factors for multiple hypotheses, including those with equality and order constraints on parameters.
- To support both exploratory and confirmatory Bayesian testing using default priors and robust handling of missing data.
- To integrate with established R modeling functions (e.g., lm, glm, lmer) for seamless adoption by researchers.
- To offer interpretable results such as Bayes factors and posterior probabilities that quantify evidence for competing scientific theories.
Proposed method
- The package uses a single, unified function BF that accepts fitted model objects (e.g., from lm, glm, lmer) and a hypothesis string specifying competing hypotheses.
- For confirmatory testing, hypotheses are defined via a string specifying equality and/or order constraints on model parameters (e.g., 'beta1 < beta2 < beta3').
- Bayes factors are computed using default priors based on recent developments in Bayesian testing for location parameters, variance components, and measures of association.
- The method supports missing at random (MAR) data by incorporating full-likelihood inference within the Bayesian framework.
- Posterior probabilities are derived from the Bayes factors and prior odds, enabling direct comparison of multiple hypotheses.
- The package leverages existing R modeling infrastructure to ensure compatibility and ease of use.
Experimental results
Research questions
- RQ1How can researchers test complex scientific hypotheses involving order and equality constraints on parameters using Bayesian methods in R?
- RQ2What is the relative evidence in the data for multiple competing hypotheses, including ordered and equality-constrained models, in common statistical models?
- RQ3How does the performance of Bayes factor testing compare to classical significance testing in terms of interpretability and consistency?
- RQ4Can Bayes factor testing be effectively applied to models with missing data, particularly in multilevel and mixed-effects settings?
- RQ5To what extent do posterior probabilities reflect updated beliefs about scientific theories after observing data in confirmatory testing?
Key findings
- In the TIMSS 2011 application, the posterior probability for the order-constrained hypothesis (NL < HR < DE < DK) was 0.509, indicating strong support for an ordered pattern in intraclass correlations across countries.
- The equality hypothesis (all ICCs equal) had a posterior probability of 0.471, showing nearly equivalent support to the ordered hypothesis.
- The complement hypothesis (any other configuration) had a low posterior probability of 0.020, indicating minimal support.
- Posterior mean estimates of ICCs were close to REML estimates, with 95% credible intervals covering the REML values, indicating robustness and consistency.
- Exploratory tests confirmed that all ICCs were positive (posterior probability = 1.0), supporting the use of multilevel modeling for the data.
- The package successfully handled missing data under MAR assumptions, maintaining accurate inference across all applications.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.