Skip to contents

Collects every spec that's been registered against a process, materializes each against the supplied env_data and strata, unions their design-matrix columns by name into a single shared design matrix X, and remaps each row's local X_col index to the global column. Used inside fit_mod() once all build_*() outputs have populated data_list.

Usage

pool_linkages(spec_groups, env_data, strata = list())

Arguments

spec_groups

named list whose names are process labels (one of LINKAGE_PROCESSES) and whose elements are themselves named lists of linkage_spec() objects keyed by parameter name. Empty entries are skipped.

env_data

data.frame of environmental covariates (one row per model year, including any factor columns referenced by spec formulas).

strata

named list of stratum-level integer vectors, e.g. list(species = 1:nspp, sex = 1:nsex).

Value

A list with components:

table

An Rceattle_linkage_table with X_col indices remapped to the global design matrix. May have zero rows.

X

A numeric matrix [nrow(env_data) x n_global_cols] with colnames(X) = the union of design-column names across specs.

design_names

colnames(X) (separate copy for caller convenience).

Details

Two design columns from different specs that share a name are assumed to carry identical numeric values (which holds for deterministic terms generated by stats::model.matrix() over the same env_data). The first occurrence wins on order; subsequent specs reuse the column.