Skip to contents

A specialisation of create_prior() where the parameter space is described by independent uniform marginals.

Usage

create_uniform_prior(
  n_dim = NULL,
  lower = 0,
  upper = 1,
  varnames = "Uniform",
  name_repair = c("unique", "universal", "check_unique")
)

Arguments

n_dim

An optional positive integer. The number of dimensions of the prior distribution. If left NULL, this is inferred from the common length of the vector-valued parameters (see Note).

lower, upper

Numeric vector of bounds for the uniform distribution.

varnames

An optional character vector. Names for the variables in the prior distribution.

name_repair

An optional, case-sensitive string. How to repair varnames. Options are "unique" (default), "universal", or "check_unique". See vctrs::vec_as_names() for details.

Value

A uniform_prior, a subclass of ernest_prior with an efficient implementation of the unit hypercube transformation.

Note

The vector-valued parameters in this function are recycled to length n_dim if it is an integer, or to a common length if n_dim = NULL. See vctrs::vector_recycling_rules for additional information on recycling.

See also

Other special_priors: create_normal_prior()

Examples

prior <- create_uniform_prior(lower = c(3, -2), upper = c(5, 4))
#> New names:
#>  `Uniform` -> `Uniform...1`
#>  `Uniform` -> `Uniform...2`
prior$fn(c(0.33, 0.67))
#> [1] 3.66 2.02