createUniformPrior {BayesianTools}R Documentation

Convenience function to create a simple uniform prior distribution

Description

Convenience function to create a simple uniform prior distribution

Usage

createUniformPrior(lower, upper, best = NULL)

Arguments

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

Note

for details see createPrior

Author(s)

Florian Hartig

See Also

createPriorDensity, createPrior, createBetaPrior, createTruncatedNormalPrior, createBayesianSetup

Examples

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))
# -Inf

# c(0.2, 2) within limits
prior$density(c(0.2, 2))
# -0.6931472


# sample from prior
prior$sampler()
# [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)

[Package BayesianTools version 0.1.7 Index]