get_default_prior_settings: Generate Prior Functions for Model Parameters

View source: R/core_bayes_estimate.R

get_default_prior_settingsR Documentation

Generate Prior Functions for Model Parameters

Description

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.

Usage

get_default_prior_settings(
  drift_dm_obj,
  level,
  means = NULL,
  sds = NULL,
  lower = NULL,
  upper = NULL,
  shapes = NULL,
  rates = NULL
)

Arguments

drift_dm_obj

a drift_dm model object.

level

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).

means

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

sds

a named numeric vector or list of standard deviations. Missing or NULL values will be replaced by corresponding values from mean.

lower, upper

optional numeric vectors or lists specifying the lower and upper truncation bounds for each prior distribution. Defaults to -Inf and Inf, respectively.

shapes, rates

optional numeric vectors or lists specifying the shape and rate parameter for group-level standard deviations (used at the hyper-level). Defaults to 1.

Details

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().

Value

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.

See Also

get_parameters_smart(), dtnorm(), rtnorm(), d_default_prior_hyper(), r_default_prior_hyper()


dRiftDM documentation built on Dec. 1, 2025, 5:08 p.m.