bceMCMC_mvrnorm_2: This is an MCMC function with a particular multivariate...

Description Usage Arguments Value Examples

Description

MCMC 4, multivariate normal distributed steps, each step is one p-dimensional vector from a multivariate normal distribution, in this case the multivariate normal distribution is the laplace approximation to the variance code for sampling gaussian correlation parameters in a gaussian process

Usage

1
bceMCMC_mvrnorm_2(nmcmc, burn, thin, x, y, reg, step, priortheta)

Arguments

nmcmc

Number of mcmc samples to generate, before burning and thinning

burn

number of samples to burn

thin

keep only one of every 'thin' samples

x

predictors

y

response

reg

currently only option is "constant"

step

actually has no purpose in this function as the step length is defined by the fisher approximation to the covariance

priortheta

only currently only option is "Exp", "Higs" and "none" will also be implemented

Value

returns a list containing mcmc.ma (samples) and accept (acceptance rates)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)
x <- as.matrix(x)
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 <- bceMCMC_mvrnorm_2(1000,10,10,x,y,reg = "constant",step =1, priortheta = "Exp")
# mean(gp$mcmc.ma[,2]) #these means should be similar to the theta parameters set above
# mean(gp$mcmc.ma[,1])

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