This function combines model specific prior distributions from
epidist_model_prior(), family specific prior distributions from
epidist_family_prior(), and user provided prior distributions into a single
set of custom priors. Each element overwrites previous elements, such that
user provided prior distributions have the highest priority. If a user prior
distribution is provided which is not a parameter of the model, a warning
will be shown.
Arguments
- data
An object with class corresponding to an implemented model.
- family
A description of the response distribution and link function to be used in the model created using
epidist_family().- formula
A symbolic description of the model to be fitted created using
epidist_formula().- prior
One or more
brmspriorobjects created bybrms::set_prior()or related functions. These priors are passed toepidist_prior()in thepriorargument. Some models have default priors that are automatically added (seeepidist_model_prior()). These can be merged with user-provided priors using themerge_priorsargument.- merge
If
TRUEthen merge new priors with existing ones, ifFALSEonly use new priors. Defaults toTRUE. This may be useful if the built in approaches for merging priors are not flexible enough for a particular use case.- enforce_presence
If
TRUEthen only allow user priors that match existing default priors. IfFALSEthen allow user priors that are not present in the default set. Defaults toFALSE.
Details
Note that the matching of priors is imperfect as it does not use brms' internal prior matching functionality. For example, it cannot distinguish between a prior for all coefficients (class = "b") and a prior for a specific coefficient (class = "b" and coef specified).
Some models add parameters which brms does not know about, such as the
event windows of the latent model. Priors for these are written using the
parameter ~ distribution syntax of brms::set_prior() and are passed to
Stan unchanged. A prior written this way replaces any existing prior for the
same parameter and is not checked against the parameters of the model. Note
that the latent model requires a uniform(0, 1) prior on its event windows.
