Abstract
In this paper, we briefly review the main methodological aspects concerned with the application of the Bayesian approach to model choice and model averaging in the context of variable selection in regression models. This includes prior elicitation, summaries of the posterior distribution, and computational strategies. We then examine and compare various publicly available R-packages for its practical implementation, summarizing and explaining the differences between packages and giving recommendations for applied users. We find that all packages reviewed lead to very similar results, but there are potentially important differences in flexibility and efficiency.
Introduction: The Challenge of Model Uncertainty
Choosing the right variables for a linear regression is a classic "needle in a haystack" problem. In linear regression, we often face a "variable selection" problem: out of dozens or hundreds of potential predictors, which ones actually belong in the model? Traditional frequentist methods, such as p-value thresholds or stepwise selection, often ignore "model uncertainty"—the risk that we have selected one "best" model while ignoring others that are nearly as statistically valid.
Bayesian methods address this by calculating the posterior probability of every possible model. Researchers can then perform Model Selection (picking the most likely model) or Bayesian Model Averaging (BMA) (averaging results across all plausible models). However, for a dataset with $p$ variables, there are $2^p$ possible models. If $p=30$, that results in over a billion models, creating significant challenges in prior elicitation and computational efficiency.
Methodology: Prior Elicitation and g-Priors
A critical step in Bayesian Variable Selection (BVS) is setting "fair" starting assumptions, or priors. The authors highlight the use of $g$-priors, which are designed to be objective and perform well even when the researcher has little prior knowledge. These are categorized into constant $g$ (where $g$ is a fixed value based on sample size $n$ or variable count $p$) and random $g$ (where $g$ is assigned a distribution).
As shown in the table above, common proposals include the Unit Information Prior (UIP) and the Zellner-Siow (JZS) Cauchy prior. Beyond $g$-priors, the choice of prior on the "model space" (the expected number of variables) is critical. The authors recommend "random" priors, such as the Beta-Binomial distribution, which automatically adjust for the number of variables and help avoid spurious discoveries.
Posterior Summaries and Algorithms
Instead of relying on a single model, BVS utilizes Posterior Inclusion Probabilities (PIP)—the probability that a specific variable belongs in the "true" model—and the Median Probability Model (MPM). To calculate these, the paper compares two main computational strategies:
- Exhaustive Enumeration: Calculating every single model, feasible only for small $p$.
- Markov Chain Monte Carlo (MCMC): Sampling the most promising models for large $p$ using algorithms like Gibbs sampling or birth-death processes.
Comparison of R Packages
The core of this study is a head-to-head comparison of four R packages: BayesFactor, BayesVarSel, BMS, and mombf. These were tested across five classic datasets ranging from the small US Crime dataset ($p=15$) to the high-dimensional Boston Housing dataset ($p=103$).
Key Findings
- Consistency: Reassuringly, when using the same priors, all four packages produce nearly identical results. The "Bayesian answer" remains stable across different software implementations.
- The "Sufficient Statistics" Advantage: A major differentiator is how packages handle data.
BMSexploits "sufficient statistics," meaning its speed is almost independent of the number of observations ($n$). Conversely,BayesVarSelrecomputes statistics for every model, making it significantly slower as $n$ grows. - Speed vs. Scale:
BayesVarSelis the fastest for small datasets. However, for the "Returns to Schooling" dataset ($n=1190$),BMScompleted the task in 1.8 hours, whileBayesVarSeltook over 11 hours. - Efficiency in Sampling: In datasets requiring MCMC (like Ozone or GDP Growth),
BayesVarSelandmombfconverged to the posterior distribution slightly faster than the algorithms used inBMS.
Conclusion and Recommendations
While all reviewed packages are robust, their efficiency depends heavily on the dataset's dimensions. For researchers working with small to moderate sample sizes ($n$), BayesVarSel offers high flexibility and speed. However, when $n$ is large, BMS is the superior choice due to its use of sufficient statistics. For very high-dimensional spaces ($p >> n$), users may need to look toward specialized "spike and slab" priors found in packages like varbvs, as the standard $g$-priors reviewed here are primarily optimized for univariate linear regression with Gaussian errors.
Summary updated