skills/brain-connectivity-modeler/SKILL.md
Advises on functional/effective connectivity methods: PPI, DCM, Granger causality, graph theory
npx skillsauth add haoxuanlithuai/awesome_cognitive_and_neuroscience_skills brain-connectivity-modelerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Brain connectivity analysis goes beyond mapping where activation occurs to ask how brain regions interact. This requires choosing among fundamentally different analytical frameworks: functional connectivity (statistical associations), effective connectivity (directed causal influences), and network topology (graph-theoretic properties). Each framework answers different questions and makes different assumptions.
A competent programmer without neuroscience training would not know the critical distinction between functional and effective connectivity, would likely confuse correlation with causation in brain networks, and would not appreciate why motion artifacts are particularly devastating for connectivity analyses. This skill encodes the domain judgment required to select and correctly implement brain connectivity methods.
Before executing the domain-specific steps below, you MUST:
For detailed methodology guidance, see the research-literacy skill.
This skill was generated by AI from academic literature. All parameters, thresholds, and citations require independent verification before use in research. If you find errors, please open an issue.
This is the most fundamental distinction in brain connectivity analysis (Friston, 2011):
| Property | Functional Connectivity | Effective Connectivity | |---|---|---| | Definition | Statistical dependency between time series | Directed causal influence of one region on another | | Directionality | Undirected | Directed | | Causality | Cannot infer causality | Attempts to infer causal structure | | Model requirement | Model-free (correlations) | Model-based (requires explicit neural model) | | Hypothesis type | Exploratory or confirmatory | Strictly confirmatory | | Primary methods | Correlation, partial correlation, ICA | DCM, PPI, structural equation modeling | | Source | Friston, 2011 | Friston, 2011; Friston et al., 2003 |
Domain warning: Functional connectivity (correlation) does not imply direct anatomical or causal connection. Two regions can show high functional connectivity because they share a common input, not because they directly influence each other (Friston, 2011).
What is your connectivity question?
|
+-- "Do regions A and B covary in activity?"
| --> Functional connectivity (correlation, partial correlation)
|
+-- "Does the coupling between A and B change with task context?"
| --> PPI (Friston et al., 1997; O'Reilly et al., 2012)
|
+-- "Does region A causally influence region B, and does this
| change with experimental manipulation?"
| --> DCM (Friston et al., 2003)
| Requires: strong prior hypotheses, limited model space
|
+-- "What is the network topology (hubs, modules, efficiency)?"
| --> Graph theory (Bullmore & Sporns, 2009)
|
+-- "Does activity in A temporally precede and predict B?"
--> Granger causality (with STRONG caveats for fMRI;
see Granger causality section below)
Critical preprocessing:
Partial correlation between regions A and B controls for shared variance with all other regions in the model. This reduces the influence of common inputs but requires careful regularization when the number of regions is large relative to the number of time points (Smith et al., 2011).
ICA decomposes the whole-brain fMRI signal into spatially independent components, each representing a network (Beckmann & Smith, 2004).
PPI tests whether the functional coupling between a seed region and other brain areas changes as a function of psychological context (e.g., task condition; Friston et al., 1997).
The PPI GLM includes three regressors:
The interaction term is the regressor of interest. A significant PPI effect means that functional coupling with the seed region differs between task conditions (O'Reilly et al., 2012).
Standard PPI tests one psychological contrast at a time. Generalized PPI (gPPI) includes all task conditions simultaneously (McLaren et al., 2012):
| Parameter | Recommendation | Source | |---|---|---| | Seed ROI definition | Functional (from activation map) or anatomical atlas; 6-10 mm sphere typical | O'Reilly et al., 2012 | | Deconvolution | Required for interaction term (SPM default); extract neural signal before computing interaction | Gitelman et al., 2003 | | Minimum events per condition | 20+ per condition for stable PPI estimates | O'Reilly et al., 2012 | | Multiple seed regions | Run separate PPI analyses per seed, then correct for multiple comparisons | O'Reilly et al., 2012 |
DCM models the causal architecture of brain regions using a biophysical generative model of neural dynamics and hemodynamic coupling (Friston et al., 2003).
A DCM is defined by three matrices:
| Matrix | Function | Interpretation | |---|---|---| | A (intrinsic) | Fixed connections between regions (always on) | Baseline coupling strength | | B (modulatory) | Condition-dependent modulation of connections | How task context changes coupling (the key experimental question) | | C (driving input) | Which regions receive direct task input | Where external stimuli enter the network |
| Requirement | Guideline | Source | |---|---|---| | Number of regions | 3-8 regions maximum | Stephan et al., 2010 | | Prior hypotheses | Strong prior hypotheses about network architecture required | Stephan et al., 2010 | | Model space size | Keep total models < 20-30 for reliable BMS | Stephan et al., 2009 | | Task design | Event-related or block designs with clear experimental manipulation | Friston et al., 2003 | | Time series extraction | From first eigenvariate of activated voxels within ROI | Stephan et al., 2010 | | Data quality | Strong task activation in all modeled regions | Stephan et al., 2010 |
After estimating all candidate models, use BMS to identify the winning model (Stephan et al., 2009):
Granger causality tests whether past values of time series X improve prediction of time series Y beyond Y's own past (Granger, 1969).
| Limitation | Explanation | Source | |---|---|---| | Hemodynamic confound | The HRF varies across brain regions by 1-2 seconds. A region with a faster HRF will appear to "Granger-cause" a region with a slower HRF, regardless of true neural timing | David et al., 2008; Seth et al., 2013 | | Low temporal resolution | fMRI TR (0.5-3 seconds) is far slower than neural dynamics (milliseconds), aliasing true causal structure | Seth et al., 2013 | | Downsampling artifacts | Subsampling a continuous process can reverse the apparent causal direction | Seth et al., 2013 |
Domain warning: Granger causality applied to fMRI BOLD signals is widely considered unreliable for inferring neural causal direction due to hemodynamic variability (David et al., 2008; Seth et al., 2013). If causal inference is needed, use DCM (which explicitly models the hemodynamic delay) or consider EEG/MEG (which has millisecond temporal resolution).
Graph theory characterizes the topological organization of brain networks (Bullmore & Sporns, 2009).
| Method | Description | Example Atlases | Source | |---|---|---|---| | Anatomical parcellation | Predefined atlas regions | AAL (116 regions), Harvard-Oxford | Tzourio-Mazoyer et al., 2002 | | Functional parcellation | Data-driven boundaries | Schaefer (100-1000 parcels), Gordon (333 parcels) | Schaefer et al., 2018; Gordon et al., 2016 | | Voxel-level | Each voxel is a node | ~100,000 nodes | Computationally expensive; rarely used for full graph metrics |
Recommendation: Use functional parcellation (Schaefer or Gordon atlases) for most analyses. Functional parcels better respect the true boundaries of functional regions than anatomical atlases (Schaefer et al., 2018).
| Method | Description | Threshold Approach | Source | |---|---|---|---| | Correlation | Pearson r between time series | Proportional (top 10-20% of connections) or absolute (r > 0.2-0.3) | Bullmore & Sporns, 2009 | | Partial correlation | Controls for indirect connections | Same thresholding options | Varoquaux et al., 2010 | | Coherence | Frequency-domain coupling | Magnitude squared coherence > threshold | Sun et al., 2004 |
Domain warning: Thresholding strategy dramatically affects graph metrics. Always report results across a range of thresholds or use proportional thresholding to control for differences in overall connectivity strength across subjects (van den Heuvel et al., 2017).
| Metric | Meaning | Normalization | Source | |---|---|---|---| | Clustering coefficient | Proportion of a node's neighbors that are also connected to each other | Normalize against random networks (C/C_random) | Watts & Strogatz, 1998 | | Characteristic path length | Average shortest path between all node pairs | Normalize against random networks (L/L_random) | Watts & Strogatz, 1998 | | Small-worldness | sigma = (C/C_random) / (L/L_random); sigma > 1 indicates small-world | N/A (already normalized) | Watts & Strogatz, 1998; Humphries & Gurney, 2008 | | Modularity (Q) | Strength of community structure; Q > 0.3 typically indicates strong modular organization | Compare against null distribution | Newman, 2006 | | Hub measures | Degree centrality, betweenness centrality, participation coefficient | Z-score within network | Bullmore & Sporns, 2009 | | Global efficiency | Inverse of mean shortest path length | Normalize against random networks | Latora & Marchiori, 2001 |
Normalization requirement: Raw graph metrics are meaningless without comparison to null models. Always normalize against random networks (preserving degree distribution) or lattice networks (Watts & Strogatz, 1998; Rubinov & Sporns, 2010). Generate at least 1,000 random networks for stable null distributions.
See references/ for detailed method implementation guides and parameter lookup tables.
tools
Convert a GitHub repository or local codebase into a well-structured Claude Code skill with progressive disclosure. Use this skill whenever the user provides a GitHub URL or local repo path and asks to turn it into a skill, create a skill from a repo, or convert a library/tool/framework into reusable skill documentation. Also trigger when users say things like 'make a skill from this repo', 'turn this codebase into a skill', or 'I want a skill for [library name]'.
development
Domain-validated guidance for cortical surface visualization and brain surface rendering of fMRI data using pycortex: data types (Volume, Vertex, Dataset), 2D cortical flatmaps, 3D WebGL brain viewers, volume-to-surface mapping, FreeSurfer/fMRIPrep integration, ROI management, and surface analysis. Use this skill whenever the user mentions pycortex, `import cortex`, cortical surfaces, brain flatmaps, WebGL brain viewers, cortical surface mapping, or wants to visualize neuroimaging data on the cortex, even if they don't explicitly name pycortex.
development
Domain-validated pipeline guidance for EEG/MEG data analysis using MNE-Python: data loading, preprocessing (filtering, ICA, re-referencing), epoching, ERP/ERF computation, time-frequency decomposition, source localization, decoding/MVPA, statistical testing, simulation, and visualization. Use this skill whenever the user works with EEG/MEG/sEEG/ECoG/NIRS/eye-tracking data in Python, mentions MNE, or needs neurophysiological analysis guidance.
development
Step-by-step guidance for contributing a new skill to the NeuroAIHub/awesome_cognitive_and_neuroscience_skills repository via GitHub Pull Request, including SKILL.md format requirements, quality rules, and PR checklist