Statistics and Computing

, Volume 17, Issue 3, pp 235–244 | Cite as

Manipulating and summarizing posterior simulations using random variable objects

  • Jouni KermanEmail author
  • Andrew Gelman


Practical Bayesian data analysis involves manipulating and summarizing simulations from the posterior distribution of the unknown parameters. By manipulation we mean computing posterior distributions of functions of the unknowns, and generating posterior predictive distributions. The results need to be summarized both numerically and graphically.

We introduce, and implement in R, an object-oriented programming paradigm based on a random variable object type that is implicitly represented by simulations. This makes it possible to define vector and array objects that may contain both random and deterministic quantities, and syntax rules that allow to treat these objects like any numeric vectors or arrays, providing a solution to various problems encountered in Bayesian computing involving posterior simulations.

We illustrate the use of this new programming environment with examples of Bayesian computing, demonstrating missing-value imputation, nonlinear summary of regression predictions, and posterior predictive checking.


Bayesian inference Bayesian data analysis Object-oriented programming Posterior simulation Random variable objects 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Chib, S.: Marginal likelihood from the Gibbs output. J. Am. Stat. Assoc. 90, 1313–1321 (1995) zbMATHCrossRefGoogle Scholar
  2. Chib, S., Jeliazkov, I.: Marginal likelihood from the Metropolis-Hastings output. J. Am. Stat. Assoc. 96, 270–281 (2001) zbMATHCrossRefGoogle Scholar
  3. Gelfand, A.E., Smith, A.F.M.: Sampling-based approaches to calculating marginal densities. J. Am. Stat. Assoc. 94, 247–253 (1990) CrossRefGoogle Scholar
  4. Gelman, A., Carlin, J.B., Stern, H.S., Rubin, D.B.: Bayesian Data Analysis, 2nd edn. Chapman & Hall/CRC, London (2003) Google Scholar
  5. Gelman, A., King, G.: A unified model for evaluating electoral systems and redistricting plans. Am. J. Political Sci. 38, 514–554 (1994) CrossRefGoogle Scholar
  6. Gelman, A., King, G., Boscardin, W.J.: Estimating the probability of events that have never occurred: when does your vote matter? J. Am. Stat. Assoc. 93, 1–9 (1998) zbMATHCrossRefGoogle Scholar
  7. Kerman, J.: Using random variable objects to compute probability simulations. Technical Report, Department of Statistics, Columbia University (2005) Google Scholar
  8. Lunn, D.J., Thomas, A., Best, N., Spiegelhalter, D.: WinBUGS—a Bayesian modelling framework: concepts, structure, and extensibility. Stat. Comput. 10, 325–337 (2000) CrossRefGoogle Scholar
  9. Oldford, R.W.: The Quail project: a current overview. Invited paper, 30th Symposium on the Interface, Minneapolis (1998).
  10. R Development Core Team: R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna (2004) Google Scholar
  11. Tierney, L.: LISP-STAT: An Object-Oriented Environment for Statistical Computing and Dynamic Graphics. Wiley, New York (1990) zbMATHGoogle Scholar
  12. Sturtz, S., Ligges, U., Gelman, A.: R2WinBUGS: a package for running WinBUGS from R. J. Stat. Softw. 12(3), 1–16 (2005). ISSN 1548-7660 Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2007

Authors and Affiliations

  1. 1.Statistical MethodologyNovartis Pharma AGBaselSwitzerland
  2. 2.Department of StatisticsColumbia UniversityNew YorkUSA

Personalised recommendations