Helper Function to Prepare a Prior for a brms Model
prepare_prior.Rd
This extends brms::prior()
by
allowing just taking a
numeric
value rather thanconstant(<value>)
to specify a constant priorif brms::brmsprior is given, it checks that it has the specified arguments
This is used in building BayesPharma models to allow user specified priors but make sure they are for the right parameters to make sure the model is well specified.
Arguments
- prior
brms::brmsprior or
numeric
.- ...
additional arguments to
brms::prior_string()
. Ifprior
is a brms::brmsprior then this will check that the slots have the given values. If prior isnumeric
, then these arguments are passed tobrms::prior_string()
Examples
if (FALSE) { # \dontrun{
# user should specify a prior for hill, but they misspell it:
user_hill_prior <- brms::prior(
prior = normal(1, 1),
nlpar = "hilll",
ub = 0)
# in a script where we want to validate the user_hill_prior
hill_prior <- BayesPharma:::prepare_prior(
prior = user_hill_prior,
nlpar = "hill")
# gives an assert error that nlpar is not set correctly
} # }