Description Usage Arguments Value Author(s) Examples
Laplace bridge Approximation of the normalizing constant
1 2 3  | normConstLaplaceBridge(sample, logPostSample, fLogPost, alpha = 0.05, 
    nd = cov.rob(sample), M = 10000, logCest = normConstLaplace(sample, 
        fLogPost, alpha, nd)["logCLV"])
 | 
sample | 
 MCMC sample of parameters, each row of the matrix is a parameter vector  | 
logPostSample | 
 the unnormalized posteror density of the sample  | 
fLogPost | 
 function to evaluate unnormalized Log-posterior for a given parameter vector  | 
alpha | 
 quantile defining the multivariate normal ellipsoid for volume correction  | 
nd | 
 normal density approximation: list with entries center and cov  | 
M | 
 number of additional simulations of posterior  | 
logCest | 
 initial estimate of the normalizing constant  | 
log of the normalization constant
Thomas Wutzler
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  | mu = c(0,0)
sd = c(1,2)
corr = diag(nrow=2)
corr[1,2] <- corr[2,1] <- 0.49
Sigma = diag(sd, nrow=length(sd)) %*% corr %*% diag(sd,nrow=length(sd)) 
n <- 1000
cTrue <- 10
sample <- mvtnorm::rmvnorm(n,mean=mu,sigma=Sigma)
fLogPost <- function(theta){ log(cTrue) + mvtnorm::dmvnorm(theta,mean=mu,sigma=Sigma, log=TRUE)}
logPostSample <- fLogPost(sample)
(CMW <- exp(normConstLaplaceBridge( sample, logPostSample, logPostSample )) )
#normd <- cov.rob(sample)
#(res <-  boot( sample, function(sample, i){normConstLaplace(sample[i,], fLogDen=fLogDen, nd=normd)}, 100))
#(res2 <-  boot( sample, function(sample, i){normConstLaplace(sample[i,], fLogDen=fLogDen)}, 100))
#normd <- cov.rob(sample)
#(res <-  boot( sample, function(sample, i){normConstLaplaceBridge(sample[i,], fLogDen=fLogDen, logDenSample, nd=normd)}, 100))
#(res2 <-  boot( sample, function(sample, i){normConstLaplaceBridge(sample[i,], fLogDen=fLogDen, logDenSample)}, 100))
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.