R/rsDCM-package.R
rsDCM-package.RdrsDCM provides a robust and sparse method for group-level Dynamic Causal Modelling (DCM) of fMRI data, together with an R implementation of single-subject DCM ported from the MATLAB SPM25 toolbox.
The package's main method is rsdcm (with the convenience
wrapper rsdcm_fit): a group-level model that weights subjects
by a Student-t likelihood (robustness to outliers) and selects group-level
effects with a nonlocal product-moment (pMOM) spike-and-slab prior
(sparsity), with ReML-estimated between-subject variance components. The
“rs” is
robust and sparse; it does not denote resting-state fMRI.
For single-subject inversion, the main entry point is
dcm_estimate.
rsdcmRobust, sparse group DCM (Student-t + pMOM).
rsdcm_fitAssemble rsdcm inputs from a list of fitted DCMs.
rsdcm_optionsGet or set package numerical options.
dcm_estimateFull DCM inversion (main entry point).
dcm_nlsi_GNVariational Laplace / Gauss-Newton inversion.
dcm_intBilinear-system integrator (forward model).
dcm_fmri_priorsConstruct fMRI DCM priors.
dcm_fx_fmri, dcm_gx_fmriNeural-state and BOLD observation equations.
dcm_bireduce, dcm_kernelsBilinear reduction and Volterra kernels.
dcm_evidence, dcm_log_evidence, dcm_log_evidence_reduceModel evidence and Bayesian model reduction.
dcm_peb_prepare, dcm_peb_runPrepare and fit a second- or third-level PEB.
dcm_peb_of_pebsThird-level PEB-of-PEBs over a directory of subject PEBs.
dcm_peb_design, dcm_peb_files, dcm_peb_loadDesign-matrix and subject-PEB loading helpers.
toy_dcmThree-region single-subject DCM specification.
narps_dcm48-subject NARPS DCM summaries used by rsdcm.
Lower-level numerical helpers (matrix and vector utilities, numerical
differentiation, matrix exponentials, and error-covariance bases) are also
exported and documented; see, for example, dcm_vec,
dcm_inv, dcm_diff, and dcm_Ce.
The single-subject DCM routines are a derivative work of the MATLAB SPM25
(version 25.01.02) toolbox, distributed under GPL-2 by the Wellcome Centre
for Human
Neuroimaging. See the LICENSE.note file in the package source for
the list of ported routines.
Arhin, G., Sanyal, N. (2026). Robust and Sparse Group Dynamic Causal Modeling via Student-t Parametric Empirical Bayes and Nonlocal Priors. arXiv:2609.06379. doi:10.48550/arXiv.2609.06379
Botvinik-Nezer, R., Holzmeister, F., Camerer, C.F., et al. (2020). Variability in the analysis of a single neuroimaging dataset by many teams. Nature, 582(7810), 84-88. doi:10.1038/s41586-020-2314-9
Friston, K.J., Harrison, L., Penny, W. (2003). Dynamic causal modelling. NeuroImage, 19(4), 1273-1302. doi:10.1016/S1053-8119(03)00202-7
Friston, K.J., Mattout, J., Trujillo-Barreto, N., Ashburner, J., Penny, W. (2007). Variational free energy and the Laplace approximation. NeuroImage, 34(1), 220-234. doi:10.1016/j.neuroimage.2006.08.035
Valerio, D., Peres, A., Bergstrom, F., Seidel, P., Almeida, J. (2025). Neural and behavioral similarity-driven tuning curves for manipulable objects. Imaging Neuroscience, 3. doi:10.1162/imag_a_00482
Useful links: