R/random-effects-marginal-covariance.R
random_effects_marginal_variance_factors.RdExtracts row-aligned design multipliers for one-column formula random-effect
blocks that are intended to be marginalized by a downstream likelihood. For
a block with SD parameter \(\tau\), the marginal variance contribution is
\(\tau^2\) times row_multiplier. With known group covariance this factor
is built from the prepared group kernel, so the dense row-space covariance
factor is \(Z K Z'\).
random_effects_marginal_variance_factors(
formula_design,
blocks = NULL,
require_diagonal = TRUE,
require_one_to_one = FALSE
)a BayesTools_formula_design object returned by
JAGS_formula() or JAGS_formula_design().
optional character vector of random-effect block names. When
NULL, only marginalized random-effect blocks are selected.
whether to require the row-space covariance factor to be diagonal. This protects downstream likelihoods that can only consume row-wise variance multipliers.
whether each observation row must map to a distinct grouping level.
A list of class
BayesTools_random_effects_marginal_variance_factors with selected block
metadata. Each block contains row_multiplier, group_map,
group_levels, model_matrix, SD metadata, compile mode, and known group
covariance metadata when present.
Unsupported factor representations signal an error inheriting from
BayesTools_random_effects_marginal_variance_unavailable. The condition
also inherits from BayesTools_random_effects_error, error, and
condition, and carries message and call. The shared parent includes
invalid allocation support errors and does not itself imply unavailability.
The unavailability condition carries stable block_name and reason
fields so downstream packages can
distinguish structural unavailability from invalid inputs. reason is one
of "row_indexed_sd", "multiple_columns",
"non_diagonal_row_covariance", or "repeated_groups".