Robert B. Gramacy Professor of Statistics

Bayesian treed Gaussian process models

tgp is an R package for fully Bayesian nonstationary, semiparametric nonlinear regression, design and optimization by treed Gaussian processes and limiting linear models.

This software is licensed under the GNU Lesser Public License (LGPL), version 2 or later. See the change log and an archive of previous versions.

The current version provides:

  • Bayesian linear models, CART, treed linear models, stationary separable and isotropic Gaussian processes, and (treed) Gaussian process single-index model
  • categorical inputs, sensitivity analysis, multi-resolution models and importance tempering are supported
  • methods for the (sequential) design of exeperiments via treed sequential maximum entropy design, active learning (ALM and ALC), and optimization by expected improvement
  • 1-d and 2-d plotting, with higher dimension projection and slice capabilities, and tree drawing for posterior summaries

Obtaining the package

  • Download R from by selecting the version for your operating system.
  • Install the tgp package, from within R. This will download, install, and configure the tgp package for you.
    R> install.packages("tgp")
  • Optionally, install the akima and maptree packages.
    R> install.packages(c("akima", "maptree"))
  • Load the library as you would for any R library.
    R> library(tgp)


  • The tgp tutorial is implemented as a package vignette, authored in Sweave. The pdf can be obtained from within R with the following code.
    R> vignette("tgp")
  • To obtain the source code contained in the vignette, use the Stangle command.
    R> v <- vignette("tgp")
  • R> Stangle(paste(v$Dir, "/doc/", v$File, sep=""))
  • Each of the examples in the vignette are also available as a demo. For example, to get the demo corresponding the example for the exponential data, do:
    R> demo("exp", package="tgp")
  • The demos were actually created using the Stangle command on the vignette sources. To see all available demos, type:
    R> demo(package="tgp")
  • Version 2.x is accompanied by a new tutorial outlining the extentions of the methods to categorical inputs, sensitivity analysis, optimization, and importance tempering. Or replace "tgp" in the vignette instructions above with "tgp2".
  • See the package documentation. A pdf version of the reference manual, or help pages, is also available. The help pages can be accessed from within R. Try starting with:
    R> help(package=tgp)
    R> ? btgp # follow the examples
  • I gave a poster at the Valencia 8 meeting (June 2006) which is a (very) condensed version of the tutorial, above.