This function creates prior distribution functions for each model parameter in a drift diffusion model (DDM), depending on the specified hierarchical level. It returns both log-density functions and, where applicable, random-sample generators based on the user-defined prior settings.
get_default_prior_settings(
drift_dm_obj,
level,
means = NULL,
sds = NULL,
lower = NULL,
upper = NULL,
shapes = NULL,
rates = NULL
)A named list with two elements:
log_dens_priors: A named list of functions. Each function returns the
log-density for a parameter value, based on the chosen prior settings.
r_priors: A named list of functions for sampling from the specified
prior distributions.
a drift_dm model object.
a character string, specifying the modeling level. Must be one
of: "hyper" (group-level priors), "lower" (individual-level priors
given group-level parameters), or "none" (non-hierarchical setting).
a named numeric vector or list, specifying the prior means for
each parameter. Missing values will be filled up from the first matching
parameter in drift_dm_obj
a named numeric vector or list of standard deviations. Missing or
NULL values will be replaced by corresponding values from mean.
optional numeric vectors or lists specifying the lower
and upper truncation bounds for each prior distribution. Defaults to -Inf
and Inf, respectively.
optional numeric vectors or lists specifying the shape and
rate parameter for group-level standard deviations (used at the hyper-level).
Defaults to 1.
Each prior is parameter-specific and wrapped using purrr::partial() so
that downstream sampling or density evaluation can be performed easily.
At the hyper-level, the functions d_default_prior_hyper() and
r_default_prior_hyper() are used. At the lower-level, the
functions dtnorm() and rtnorm() are used.
The input arguments means, sds, lowers, uppers, shapes, and rates
are handled by the function get_parameters_smart().
get_parameters_smart(), dtnorm(),
rtnorm(), d_default_prior_hyper(),
r_default_prior_hyper()