Sets the factor levels of a factor prior distribution used
outside a formula, e.g., in the prior_list of JAGS_fit(). The
prior receives the complete factor metadata that the priors of formula
factor terms carry: the number and names of the levels, the contrast, and
the design that maps its coefficients to the levels. JAGS_fit() requires
this metadata of every factor prior outside a formula and stops without it.
prior_factor_levels(prior, levels)a factor prior distribution (prior_factor() or
prior_ordered()), or a mixture or spike-and-slab prior of factor prior
distributions.
the number of factor levels, or a character vector with the level names.
The prior distribution with its factor levels.
The contrast of the prior determines the number of coefficients:
one per level for contrast = "independent" and ordered priors with
contrast = "cumulative_levels", and one per level after the first
otherwise. Levels given by their number are named "1", "2",
and so on. The factor is named after the parameter under which the prior is
fitted.
Bound mixture and spike-and-slab components use the declared design's raw
coefficient and cell dimensions. Scalar component families draw independent
raw coordinates; multivariate families retain their joint law, including
a shared scale for multivariate t draws. Each row shares one component or
inclusion gate across its coordinates. Standalone sampling and initialization
retain their existing contracts.
p <- prior_factor("mnormal", list(mean = 0, sd = 1), contrast = "meandif")
p <- prior_factor_levels(p, c("low", "medium", "high"))