Description Usage Arguments Value Examples
Univariate, Normally distributed step length MCMC function, meant only to be used by gpMCMC function
1 | bceMCMC_norm(nmcmc, burn, thin, x, y, reg, step, priortheta)
|
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" |
returns a list containing mcmc.ma (samples) and accept (acceptance rates)
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_norm(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])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.