bceMCMC: Univariate, Uniform step length MCMC function, meant to be...

Description Usage Arguments Value Examples

Description

Univariate, Uniform step length MCMC function, meant to be used by gpMCMC function

Usage

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

Arguments

nmcmc

number of MCMC samples to be generated before thinning and burning

burn

number of mcmc samples to burn

thin

keep one of every 'thin' samples

x

covariates

y

response

reg

only option currently is "constant"

step

step length for mcmc

priortheta

only option currently is "Exp"

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
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 <- bceMCMC(1000,10,10,x,y,reg = "constant",step =0.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.