Learn R Programming

BayesianTools (version 0.1.0)

createPriorDensity: Fits a density function to a multivariate sample

Description

Fits a density function to a multivariate sample

Usage

createPriorDensity(sampler, method = "multivariate", eps = 1e-10,
  lower = NULL, upper = NULL, best = NULL, ...)

Arguments

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

See Also

createPrior createBetaPrior createTruncatedNormalPrior createUniformPrior createBayesianSetup

Examples

Run this code
# 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)


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)

Run the code above in your browser using DataLab