Classifies compiled random-effect terms as wholly independent estimate-level variation or contextual variation shared across observations. Classification uses the declared group map, coefficient structure, fixed design supports, and known group covariance, never draws or numerical factors.

random_effects_source_roles(random_effects, n_rows)

Arguments

random_effects

Compiled random_effects terms from a BayesTools_formula_design.

n_rows

Number of observation rows.

Value

A named character vector, keyed by block name, containing "estimate", "context", or "mixed" for every term.

Details

A term with one observation per independent group remains estimate-level variation even with random slopes or multiple coefficients. Exact zeros in a compiled known group covariance can certify independence. For id() and diag(), disjoint coefficient supports can also certify an independent term. A contextual coefficient family remains contextual when some of its observed groups contain only one row. Terms mixing independent and contextual coefficient families have the role "mixed". Integrating the complete term remains well defined; a downstream conditioning model must reject partial-term retention unless it explicitly supports it.

Roles do not depend on whether coefficients are sampled or marginalized, on their SDs, or on the realized covariance in a posterior row.