BMS 0.3.0 Released

[This article was first published on BMS Add-ons » BMS Add-ons, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Version of 0.3.0 of the Bayesian Model Averaging package BMS has been released. Apart from numerous bugfixes, BMS 0.3.0 includes two main additions:

  • The ability in bms to keep certain fixed regressors to be included in all sampled models
  • The option to calculate predictive densities with function pred.density.

Moreover, the interrnal structure has been redesigned to accommodate user-defined priors and samplers.

Updating / Installing the new Version

If you are running R version 2.13 or above under Windows or any R version under Linux or Mac OS X, then simply type the R command:


If you are running an older R version under Windows, then use the following command, or refer to the manual installation page.

  • Windows R version 2.10 to 2.12: type:
    install.packages("BMS", contriburl="")
  • Windows R version 2.5 to 2.9: type:
    install.packages("BMS", contriburl="")

After installation, you may verify the version number by typing the following commands:


The corresponding help entry should then display the version number 0.3.0.

New Feature: Keeping Fixed Regressors

The new argument fixed.reg in function bms allows for keeping a fixed set of regressors to be included in all models. Take, for instance, the built-in attitude data set. A researcher might be certain that any model for the dependent variable rating should be based at least on the regressors learning and complaints. She just is not sure whether to add the remaining four regressors and wants to preform Bayesian Model Averaging over these four variables. The corresponding command is:

m1 = bms(attitude, mprior = "uniform", fixed.reg = c("complaints","learning"))

The resulting output then shows that the Posterior Inclusion Probabilities for learning and complaints are indeed at 100%. The resulting object m1 is a standard bma object and may be processed with any of the BMS functions.
For more details, consult chapter A.4 of the BMS tutorial.

New Feature: Predicitve Density

BMS now allows for creating predicitive densities that conform to the many available priors. For illustration, consider again the built-in dataset attitude. We might use the first 27 observations to forecast the final 3 observations.

m2 = bms(attitude[1:27,])
pp = pred.density(m2, newdata=attitude[28:30, -1])

The object pp now holds the prediction for these 3 observations, conditional on what we know from the first 27 observations and the explanatory data. Several functions are available to extract meaningful information. For instance, the following command provides a plot of predictive densities for each data point:


Other functions are available to extract quantiles, densities for realized outcomes, standard errors, etc. For more details compare help(pred.density) or chapter 6 in the BMS tutorial.

User-defined Priors and Samplers

For more R-savy users, BMS now offers the possibility to write customized ‘plug-in’ priors: this applies to both the coefficient (g) priors and model priors. Similarly, the new version also implements limited customizability for MCMC samplers. For more details consider the tutorials on custom priors.

Other changes vs previous versions

The functionality of the BMS version 0.3.0 is compatible with earlier versions (0.2.5), therefore any previously user-written BMS code should continue to function.
Nonetheless, numerous bug-fixes to deal with exceptional situations have been implemented and required changes to many internal objects. For more details, consider the package technical News file.

To leave a comment for the author, please follow the link and comment on their blog: BMS Add-ons » BMS Add-ons. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)