Gathers the first-level posterior densities, selects the parameter indices implied by field, projects them onto a rank-reduced subspace, and builds the second-level priors, hyperpriors and precision components. Mirrors the preparation half of SPM25's spm_dcm_peb.

dcm_peb_prepare(P, M = list(), field = c("A", "B"))

Arguments

P

List of estimated DCMs (or, for a PEB-of-PEBs, a list of PEBs). Each element must carry M$pE, M$pC, Ep, Cp and F.

M

Second-level model specification. Recognised fields: X (design matrix, subjects x covariates), W, Q (covariance component option, see Details), bE, bC, pC, hE, hC, alpha, beta, Xnames, maxit. Defaults to an intercept-only design.

field

Character vector of parameter blocks to model (e.g. c("A", "B")), the string "all" for every named block, or numeric indices into dcm_vec(M$pE).

Value

A list ("prep") consumed by dcm_peb_run, holding the projected densities, design, priors, precision components and sizes.

Details

M$Q selects the form of the second-level precision components: "single" (one component, the default), "fields" (one per requested field), "all" (one per parameter), "none" (no components), or a list of numeric matrices for manual specification.

See also

dcm_peb_run to fit the prepared model.