Convenience function to create a simple uniform prior distribution
createUniformPrior(lower, upper, best = NULL)
lower | vector of lower prior range for all parameters |
---|---|
upper | vector of upper prior range for all parameters |
best | vector with "best" values for all parameters |
for details see createPrior
createPriorDensity
, createPrior
, createBetaPrior
, createTruncatedNormalPrior
, createBayesianSetup
set.seed(1) prior <- createUniformPrior(lower = c(0,0), upper = c(0.4,5)) # c(2, 3) outside of limits prior$density(c(2, 3))#> [1] -Inf# -Inf # c(0.2, 2) within limits prior$density(c(0.2, 2))#> [1] -0.6931472# -0.6931472 # sample from prior prior$sampler()#> [1] 0.2291413 4.5410389# [1] 0.2291413 4.5410389 ## the prior object can be passed to createBayesianSetup() # log-likelihood density function (needed for createBayesianSetup) ll <- function(x) sum(dnorm(x, log = TRUE)) setup <- createBayesianSetup(prior = prior, likelihood = ll)