Skip to content

statistical algorithms in NIMBLE

perrydv edited this page Mar 24, 2015 · 5 revisions

Implementing Statistical Fitting Algorithms for R through NIMBLE

Summary: Adding algorithms to the NIMBLE package for using hierarchical models written in the BUGS language.

Description: NIMBLE is a package for implementing statistical algorithms that can use the BUGS language (not the BUGS software) from R. The system for programming in NIMBLE uses a domain-specific language (DSL) embedded within R that can be compiled via C++. The NIMBLE DSL is a subset of R syntax that includes math, flow control, and access to models created from BUGS code. The NIMBLE compiler generates C++ code from the DSL, compiles it, and interfaces to it from R. We currently have a basic MCMC implementation with conjugate, adaptive Metropolis-Hastings, and slice sampling. We also have prototype MCEM and particle filtering algorithms implemented. We are interested in implementing a variety of other important existing algorithms. Exactly which algorithms can be determined based in part on the interest of the student, but possibilities include sequential Monte Carlo (aka particle filtering, in various flavors), variational Bayes, Laplace approximation, integrated nested Laplace approximation, etc.

Related work: There are a variety of packages in R and for other languages that implement the algorithms mentioned above, some of them specific to particular model structures. The distinction is that we wish to provide algorithms through our system that will be available for any BUGS model for which the algorithm is appropriate and will execute with the efficiency of compiled C++.

Potential tasks:

  • Get up to speed on programming in NIMBLE within R.
  • Prioritize algorithms to implement.
  • Implement algorithm(s) in NIMBLE.
  • Write unit tests of new functionality.
  • Write documentation.

Skills required / desired:

  • Understanding of and ability to implement statistical algorithms.
  • Good working knowledge of R.
  • Ability to learn NIMBLE programming.
  • Understanding of numerical methods.
  • Basic knowledge of github.

Test: Laplace approximation can be used to approximate integrals of the form E(h(theta)|y) where the expectation is with respect to the posterior distribution for theta given the data, y, as discussed in Tierney & Kadane (Journal of the American Statistical Association (1986) 81:82-86). Assuming you have an R function that evaluates the posterior density for the model, where theta is the first argument, and an R function that implements the function h(), where theta is the first argument, write an R function that implements Laplace approximation of E(h(theta)|y).

Mentor: Perry de Valpine ([@](mailto:pdevalpine {at} berkeley {dot} edu)), Chris Paciorek ([@](mailto:paciorek {at} stat {dot} berkeley {dot} edu)) and Duncan Temple Lang([@](mailto:dtemplelang {at} ucdavis {dot} edu)).