gpMCMC: Master MCMC function

Description Usage Arguments Details Value Examples

Description

Simulates hyperparameters from the posterior distribution of a gaussian process that uses a Gaussian correlation function. Currently, the only prior available is an Exponential prior and the only regression model is a constant one.

This package is currently under developement.

Usage

1
2
gpMCMC(nsamp, burn, thin, x, y, reg = "constant", step = 1,
  priortheta = "Exp", method = "mvrnorm", plot = FALSE)

Arguments

nsamp

number of MCMC samples to be generated

burn

number of samples to be burned, must be less than nsamp

thin

only include one of every 'thin' samples. If thin is 10, only include one in every 10 samples

x

covariate matrix/ vector x

y

response vector

reg

regression model, defaults to "constant"

step

step length for MCMC, defaults to 1

priortheta

prior, defaults to Exponential prior

method

proposal distribution, defaults to "mvrnorm2", other options include "normal", "mvrnorm", and "uniform"

plot

defaults to FALSE, whether or not to plot simulated points against pairs of hyperparameters

Details

There exist a number of options for the Metropolis algorithm proposal density, which can be univariate uniform, univariate normal, multivariate normal, or multivariate normal with a specialized covariance matrix The specialized covariance requires initial point inference of the hyper-parameters and also some assumptions need to be checked, such as positive definiteness of the covariance matrix, obtained via a fisher approximation using the HessFBI function.

The package provides the means for sampling from Posterior Distributions of Gaussian Processes that use the Gaussian Correlation function. This package also provides a function for computing the Fisher approximation to the covariance of this posterior likelihood distribution. To be added:

1. Additional priors: currently the only prior being used is the Exponential Prior 2. Ability to make calls to gasp software so that posterior inference can be done in C. This will make functions mcmc_mvrnorm_2 and fitGauss functional (these functions are currently not functional) 3. A plotting mechanism for plotting the samples against pairs of covariates. 4. An "FBI-Sampling" method, for sampling from the Fischer Approximated distribution of hyper-parameters

Value

returns a list containing the mcmc samples (mcmc_samples) and the acceptance rates for each covariate (acceptance)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
nsamp <- 100
burn <- 200
thin <- 10

n <- 10
x1 <- seq(-5,10,length.out = n)
x2 <- seq(0,15,length.out = n)
x <- expand.grid(x1,x2)
d2 <- c(0.01,0.2,0,0) #here we set the theta parameters to be 0.01 and 0.2.
#These are the modes of the distribution that we will sample from using MCMC
cor.par <- data.frame(matrix(data = d2,nrow = dim(x)[2],ncol = 2))
names(cor.par) <- c("Theta.y","Alpha.y")

R <- cor.matrix(x,cor.par) # obtain covariance matrix
L <- chol(R)
z <- as.matrix(rnorm(n^2))
y <- L%*%z

gp <- gpMCMC(nsamp,burn,thin,x,y,step = 1)
mean(gp$samples[,2]) #these means should be similar to the theta parameters set above
mean(gp$samples[,1])

galotalp/gpMCMC documentation built on May 16, 2019, 5:36 p.m.