prior_ordered creates a factor prior for ordered predictors by separating a scalar total effect from an allocation of that effect across ordered-level increments.

prior_ordered(
  total,
  allocation = NULL,
  contrast = "cumulative",
  id = NULL,
  prior_weights = 1
)

Arguments

total

scalar prior for the first-to-last effect with "cumulative", or the last level's effect from the zero baseline with "cumulative_levels".

allocation

allocation prior or fixed split. NULL creates a late-bound flat Dirichlet allocation with dimension determined by the formula term. Numeric vectors specify fixed splits of finite nonnegative weights with a finite total and roundoff bound, summing to one within that bound. Dirichlet priors specify random allocations. For terms with multiple ordered factors, use a named list. A list is available in a JAGS_formula() term only: sampling or plotting a standalone prior, or setting its levels with prior_factor_levels(), raises BayesTools_ordered_unavailable.

contrast

ordered contrast. "cumulative" uses nlevels(f) - 1 increments and sets the first level effect to zero. "cumulative_levels" uses nlevels(f) increments and gives the first level a non-zero allocation share.

id

optional allocation-sharing id. Sharing uses the id and factor together. For terms with multiple ordered factors, use a named character vector; partial named maps may be reused across terms.

prior_weights

prior odds associated with a given distribution. The value is passed into the model fitting function, which creates models corresponding to all combinations of prior distributions for each of the model parameters and sets the model priors odds to the product of its prior distributions.

Value

return an object of class 'prior'.

Details

Spike-and-slab or mixture behavior belongs on total; e.g., prior_ordered(prior_spike_and_slab(...)). Ordered density methods preserve point masses and continuous probability separately for each level; point masses are not included in a kernel density estimate. Bridge sampling is available only when total is a nonexpression, nondiscrete simple scalar prior and allocation is fixed or a simple Dirichlet allocation. Mixtures of bound ordered prior containers (see prior_factor_levels()) can be constructed and sampled, but their binding in JAGS_formula() is unavailable. Put the mixture on total instead. General mixture totals require a single slice; multi-slice interactions support simple scalar, point, and spike-and-slab totals. Unsupported binding raises BayesTools_ordered_unavailable. Factors use their bound levels() order, including character predictors converted to factors by the formula. Without id, each ordinary-factor slice has an independent allocation. With id, one allocation is shared by all slices and terms with the same id and factor. Joint prior sampling uses the first owner's allocation draws; separate standalone sampling calls remain independent.

Estimates tables with transform_factors = TRUE report the level effects (the first level of a "cumulative" contrast is the reference and has no row). With transform_factors = FALSE, they report the sampled parameters: the total effect, labelled f{total}, and, for random allocations, the allocation share of each increment, labelled by the level the increment reaches, f[share: mid] (see runjags_estimates_table(), ensemble_estimates_table(), and parameter_labels() for the labels of terms with several slices or predictors). The total (one per slice) and each share of a random allocation are quantities of the parameter catalog (parameter_catalog()), also under their earlier names (f_ordered_total, f_ordered_allocation[mid]), and hypothesis_BF() tests them (for example "f{total} = 0" or "f[share: mid] > 0.5"): the total has the prior law of total, a share the Beta marginal of its Dirichlet allocation. A spike-and-slab or mixture total needs conditional = TRUE for point tests at its null. Totals and primitive shares remain on the fitted scale when interactions prevent an original-scale factorization. Inclusion conditioning uses the declared total event; a discrete total alone does not create such an event. Literal numeric arguments are emitted at round-trip precision and persisted with the bound recipe. Fits without that provenance require refitting.