neuroaihub/brainpilot/brain-connectivity-modeler
Claude Code and agent skill by neuroaihub/brainpilot
- community
Checking that the SKILL.md file is still in the repository.
Advises on functional/effective connectivity methods: PPI, DCM, Granger causality, graph theory
Install
npx vskill@latest install neuroaihub/brainpilot/brain-connectivity-modelerSKILL.md
The same SKILL.md was published earlier as neuroaihub/brainpilot/brain-connectivity-modeler.
Brain Connectivity Modeler
Purpose
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.
When to Use This Skill
- Choosing a connectivity method for task-based or resting-state fMRI
- Implementing psychophysiological interaction (PPI) analysis
- Setting up dynamic causal models (DCM)
- Applying graph theory to brain network data
- Evaluating whether Granger causality is appropriate for fMRI
- Reviewing or troubleshooting existing connectivity analyses
Research Planning Protocol
Before executing the domain-specific steps below, you MUST:
- State the research question — What specific question is this analysis/paradigm addressing?
- Justify the method choice — Why is this approach appropriate? What alternatives were considered?
- Declare expected outcomes — What results would support vs. refute the hypothesis?
- Note assumptions and limitations — What does this method assume? Where could it mislead?
- Present the plan to the user and WAIT for confirmation before proceeding.
For detailed methodology guidance, see the research-literacy skill.
⚠️ Verification Notice
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.
Functional vs. Effective Connectivity
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).
Method Selection Decision Tree
Functional Connectivity Methods
Seed-Based Correlation
- Extract mean time series from a seed ROI
- Compute Pearson correlation with all other voxels (or ROIs)
- Apply Fisher z-transformation: z = 0.5 * ln((1+r)/(1-r)) before group statistics (Fisher, 1921)
- Enter z-maps into second-level group analysis
Critical preprocessing:
- Apply stringent motion correction: FD threshold < 0.2 mm for scrubbing or censoring (Power et al., 2014)
- Band-pass filter to 0.01-0.1 Hz for resting-state (Biswal et al., 1995; but see Niazy et al., 2011 for caveats)
- Regress out motion parameters (24-parameter model), WM/CSF signals (aCompCor; Behzadi et al., 2007)
Partial Correlation
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).
- Use regularized partial correlation (e.g., L1-penalized precision matrix) when the number of ROIs exceeds ~20% of the number of time points (Varoquaux et al., 2010)
Independent Component Analysis (ICA)
ICA decomposes the whole-brain fMRI signal into spatially independent components, each representing a network (Beckmann & Smith, 2004).
- Model order (number of components): 20-25 for major networks; 70-100 for fine-grained parcellation (Smith et al., 2009)
- Group ICA: Use temporal concatenation or dual regression (Beckmann et al., 2009; Nickerson et al., 2017)
- Artifact identification: Classify components as signal or noise based on spatial pattern, power spectrum, and temporal properties (Griffanti et al., 2017)
Psychophysiological Interactions (PPI)
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).
PPI Model Specification
The PPI GLM includes three regressors:
- Physiological regressor: Deconvolved time series from the seed region (the neural signal estimate)
- Psychological regressor: The task regressor (e.g., condition A vs. condition B)
- Interaction term: Element-wise product of the physiological and psychological regressors, reconvolved with the HRF
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).
Generalized PPI (gPPI)
Standard PPI tests one psychological contrast at a time. Generalized PPI (gPPI) includes all task conditions simultaneously (McLaren et al., 2012):
- Create separate PPI terms for each condition
- Include all main-effect task regressors and the seed time series
- More sensitive than standard PPI because it properly accounts for all conditions
- Recommended over standard PPI for designs with more than two conditions (McLaren et al., 2012)
PPI Practical Considerations
| 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 |
Dynamic Causal Modeling (DCM)
DCM models the causal architecture of brain regions using a biophysical generative model of neural dynamics and hemodynamic coupling (Friston et al., 2003).
DCM Model Specification
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 |
DCM Requirements and Constraints
| 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 |
Bayesian Model Selection (BMS)
After estimating all candidate models, use BMS to identify the winning model (Stephan et al., 2009):
- Fixed-effects BMS (FFX): Assumes all subjects have the same model. Use when sample is homogeneous
- Random-effects BMS (RFX): Allows different subjects to have different optimal models. Use for heterogeneous populations (Stephan et al., 2009)
- Family-level inference: Group models into families sharing a feature (e.g., all models with a particular connection), then compare families. More robust than individual model comparison (Penny et al., 2010)
- Report exceedance probability (probability that a model/family is more likely than all others) and protected exceedance probability (corrected for chance; Rigoux et al., 2014)
DCM Pitfalls
- Too many models: Exhaustive model comparison with > 30 models leads to unreliable BMS (Stephan et al., 2010)
- No activation in modeled regions: DCM requires that included regions show significant task-related activation. Including silent regions produces unreliable estimates
- Confusing DCM with Granger causality: DCM models neural dynamics, not temporal precedence in BOLD signals
Granger Causality
Granger causality tests whether past values of time series X improve prediction of time series Y beyond Y's own past (Granger, 1969).
Severe Limitations for fMRI
| 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 for Brain Networks
Graph theory characterizes the topological organization of brain networks (Bullmore & Sporns, 2009).
Node Definition
| 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 |
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/skills/skills/06_fMRI_Neuroimaging/brain-connectivity-modeler/SKILL.md
Popularity
- Repository stars
- 884
- Repository forks
- 61
- 7-day trend score
- 34
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/neuroaihub/brainpilot/brain-connectivity-modeler)