This R implementation consists in 2 packages that need to be installed in this order:
GibbsPosteriorRequired
GibbsPosterior
As GibbsPosterior
uses C++ code, the package Rcpp is a prerequisite.
Moreover, GibbsPosterior
makes use of the GNU Scientific Library so the package RcppGSL is also required.
If it is not already done, install Rcpp and RcppGSL.
Move to the GibbsPosterior/
folder and execute the following commands:
R CMD build GibbsPosteriorRequired
R CMD INSTALL GibbsPosteriorRequired
cd ..
R CMD build GibbsPosterior
R CMD INSTALL GibbsPosterior
The GibbsPosteriorC
functions samples from the Gibbs reference posterior distribution on the correlation lengths for Kriging models with Matérn anisotropic (tensorized or geometric) kernel.
It does this using a Metropolis-within-Gibbs algorithm, as detailed in the article Optimal compromise between incompatible conditional probability distributions, with application to Objective Bayesian Kriging
It expects the following arguments, in this order:
- The dimension of the input space.
- The smoothness of the Matérn kernel.
- The number of points that must be sampled from the Gibbs reference posterior distribution.
- Thinning factor (the length of the Gibbs sampling Markov chain is number of points to be generated * thinning factor).
- Standard deviation used in the Metropolis part of the algorithm.
- Dimension of the trend vector space.
- Seed of the random generator.
- Vector of two strings. The first string must be "REML": it corresponds to an option that is now deprecated. The second string must be either "tensorise" if the anisotropic Matérn kernel should be tensorized or "geometrique" if it should be anisotropic geometric.
- Matrix of inputs. Every row corresponds to a point, every column to a dimension of the input space.
- Vector of outputs. Its size shoulf be the same as the number of rows of the matrix of inputs.
- Trend matrix. Each columns contains the values of one basis function of the trend vector space at the rows in the matrix of inputs.
- Starting point of the Gibbs algorithm (i.e. the initial values of the correlation lengths).
`GibbsPosteriorC' produces an R object whose "posterior" attribute contains the sample from the Gibbs reference posterior distribution.
An exemple is given in the script test_basique.r
in the tests/
folder.