Convenience wrapper around rsdcm that assembles its
inputs from a list of estimated DCMs (as returned by
dcm_estimate). For each subject it takes the posterior mean
Ep and covariance Cp restricted to the requested parameter
field, builds a between-subject design, and fits the robust + sparse group
model.
rsdcm_fit(P, field = "A", covariates = NULL, X_G = NULL, V_list = NULL, ...)List of estimated DCMs; each must carry Ep, Cp, and
M$pE/M$pC (or options) so the field indices can be
resolved.
Parameter block(s) to model at the group level, named as in the
DCM parameter structure Ep. For an fMRI DCM these are "A",
"B", "C", "D", "transit", "decay" and
"epsilon"; pass one (e.g. "A") or several (e.g.
c("A", "B")). Case-sensitive: the connectivity blocks are uppercase
("A", not "a"). Passed to dcm_find_pC.
Optional data frame of between-subject covariates, one row
per subject; NULL gives an intercept-only design (the group mean).
Ignored if X_G is supplied.
Optional group design matrix (N x r); overrides covariates.
Optional list of p x p variance-component bases; defaults to a per-parameter diagonal basis.
Further arguments passed to rsdcm (e.g.
nu, pi, verbose).
The list returned by rsdcm, with the group
effects, conditional Laplace standard deviations, integrated PIPs, and
diagnostics labelled by parameter and design columns, plus
param_index.
All subjects must share the same parameterisation, so the selected field
indices are required to match across P.
# rsdcm_fit() consumes a list of fitted DCMs (each from dcm_estimate), then
# fits the group model on a chosen field:
# fits <- lapply(dcm_files, function(f) dcm_estimate(readRDS(f)))
# grp <- rsdcm_fit(fits, field = "A", covariates = my_covariates)
# See ?rsdcm for a self-contained group-level example.