R/JAGS-formula-random-marginal-covariance.R
JAGS_formula_random_marginal_covariance.RdCompiles sampled or marginalized formula random-effect metadata into deterministic JAGS nodes containing observation-level covariance contributions. The compiler is intentionally likelihood agnostic: callers provide dependency-preserving row blocks and choose which terms contribute by subsetting the formula design. Sampling latent coordinates does not change their population covariance.
JAGS_formula_random_marginal_covariance(
formula_design,
row_blocks,
prefix = "random_marginal_covariance",
representation = c("dense", "auto")
)a BayesTools_formula_design object created by
JAGS_formula().
list of integer vectors partitioning the fitted rows.
valid JAGS node prefix used for generated nodes and data.
covariance representation to compile. "dense"
preserves the lower-triangle interface. "auto" returns the complete
structurally certified diagonal-plus-factor representation when available
and otherwise uses the dense representation.
A list of class BayesTools_JAGS_random_marginal_covariance with
syntax (the JAGS model syntax as one string), data (the named list of
data the syntax reads), row_blocks (the validated integer row vectors),
representation ("dense", or the diagonal-plus-factor representation
that "auto" returns when it is structurally certified), term_names
(the compiled random-effect block names), and the node names per row
block. Dense results contain one lower-triangle covariance node name per
row block in lower_names and NA in diagonal_names and
loading_names. Diagonal-plus-factor results instead contain
diagonal_names, loading_names (NA for a block without loading
columns), and structural loading_ranks. A formula design without
random effects returns empty syntax and data.