# ------------------------------------------------
# a 3D un-normalised Normal density
my_posterior <- function(theta) {
cov <- matrix(c(1,0.98,0.8,0.98,1.0,0.97,0.8,0.97,2.0), nrow = 3)
logP <- mvtnorm::dmvnorm(theta, mean=c(-1,2,0),
sigma = cov, log = TRUE)
return(logP)
}
# ------------------------------------------------
# test
chain <- gw_sampler(my_posterior, theta.0=c(0,0,0), nsteps=10e4, burn.in = 1e4)
chain_diagnosis(chain)
contour_matrix(chain$theta, prob.levels=c(0.683, 0.9, 0.99), smooth1d=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.