Fits a density function to a multivariate sample
createPriorDensity(sampler, method = "multivariate", eps = 1e-10, lower = NULL, upper = NULL, best = NULL, ...)
sampler | an object of class BayesianOutput or a matrix |
---|---|
method | method to generate prior - default and currently only option is multivariate |
eps | numerical precision to avoid singularity |
lower | vector with lower bounds of parameter for the new prior, independent of the input sample |
upper | vector with upper bounds of parameter for the new prior, independent of the input sample |
best | vector with "best" values of parameter for the new prior, independent of the input sample |
... | parameters to pass on to the getSample function |
createPrior
createBetaPrior
createTruncatedNormalPrior
createUniformPrior
createBayesianSetup
# Create a BayesianSetup ll <- generateTestDensityMultiNormal(sigma = "no correlation") bayesianSetup = createBayesianSetup(likelihood = ll, lower = rep(-10, 3), upper = rep(10, 3)) settings = list(iterations = 2500) out <- runMCMC(bayesianSetup = bayesianSetup, settings = settings)#> Running DEzs-MCMC, chain 1 iteration 300 of 2502 . Current logp -13.13027 -13.9082 -12.99289 . Please wait! Running DEzs-MCMC, chain 1 iteration 600 of 2502 . Current logp -17.17077 -15.83237 -14.44773 . Please wait! Running DEzs-MCMC, chain 1 iteration 900 of 2502 . Current logp -14.78237 -12.37018 -13.75772 . Please wait! Running DEzs-MCMC, chain 1 iteration 1200 of 2502 . Current logp -13.2786 -13.84704 -14.69235 . Please wait! Running DEzs-MCMC, chain 1 iteration 1500 of 2502 . Current logp -12.24353 -12.61178 -12.44291 . Please wait! Running DEzs-MCMC, chain 1 iteration 1800 of 2502 . Current logp -11.88731 -13.33655 -14.25091 . Please wait! Running DEzs-MCMC, chain 1 iteration 2100 of 2502 . Current logp -13.29007 -13.83644 -13.27353 . Please wait! Running DEzs-MCMC, chain 1 iteration 2400 of 2502 . Current logp -12.2154 -13.3844 -18.34041 . Please wait! Running DEzs-MCMC, chain 1 iteration 2502 of 2502 . Current logp -18.18653 -14.181 -13.19644 . Please wait!#>newPrior = createPriorDensity(out, method = "multivariate", eps = 1e-10, lower = rep(-10, 3), upper = rep(10, 3), best = NULL) bayesianSetup <- createBayesianSetup(likelihood = ll, prior = newPrior) settings = list(iterations = 1000) out <- runMCMC(bayesianSetup = bayesianSetup, settings = settings)#> Running DEzs-MCMC, chain 1 iteration 300 of 1002 . Current logp -7.545238 -7.446456 -7.128085 . Please wait! Running DEzs-MCMC, chain 1 iteration 600 of 1002 . Current logp -8.492681 -7.42916 -7.616632 . Please wait! Running DEzs-MCMC, chain 1 iteration 900 of 1002 . Current logp -8.09548 -7.647625 -7.012468 . Please wait! Running DEzs-MCMC, chain 1 iteration 1002 of 1002 . Current logp -7.20372 -9.717723 -10.57818 . Please wait!#>