Specify a prior with normally distributed marginals
Source:R/special_priors.R
create_normal_prior.RdA specialisation of create_prior() where the parameter space is
described by independent normal variables, possibly truncated.
Usage
create_normal_prior(
mean = 0,
sd = 1,
names = "Normal",
lower = -Inf,
upper = Inf,
.n_dim = NULL,
.name_repair = c("unique", "universal", "check_unique")
)Arguments
- mean
Numeric vector of means.
- sd
Numeric vector of standard deviations (must be strictly positive.)
- names
An optional character vector. Names for the variables in the prior distribution.
- lower, upper
Numeric vector of bounds for a truncated normal distribution.
- .n_dim
An optional positive integer. The number of dimensions of the prior distribution.
- .name_repair
An optional, case-sensitive string. How to repair
names. Options are"unique"(default),"universal", or"check_unique". Seevctrs::vec_as_names()for details.
Value
A normal_prior, a subclass of ernest_prior with an efficient
implementation of the unit hypercube transformation.
Note
See vctrs::vector_recycling_rules for additional information on how parameters are recycled to a common length.
See also
create_prior()for more on theernest_priorobject.truncnorm::qtruncnorm()for the truncated normal quantile function.
Other special_priors:
create_uniform_prior()
Examples
prior <- create_normal_prior(.n_dim = 3)
#> New names:
#> • `Normal` -> `Normal...1`
#> • `Normal` -> `Normal...2`
#> • `Normal` -> `Normal...3`
prior$fn(c(0.25, 0.5, 0.75))
#> [1] -0.6744898 0.0000000 0.6744898