Best for
- Planning sample size for a new fMRI, EEG, or MEG study
- Conducting power analysis for a grant application or registered report
- Estimating required N when pilot data or published effect size maps are available
NeuroAIHub/BrainPilot/packages/skills/skills/15_Others/neuroimaging-sample-size-calculator/SKILL.md
Simulation-based sample-size planning for neuroimaging studies using effect-size maps
Decision brief
Simulation-based sample-size planning for neuroimaging studies using effect-size maps
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/NeuroAIHub/BrainPilot --skill "packages/skills/skills/15_Others/neuroimaging-sample-size-calculator"Inspect the Agent Skill "neuroimaging-sample-size-calculator" from https://github.com/NeuroAIHub/BrainPilot/blob/e9ddc112cab9b1c6272dae0c8a6bdceb5c9c3880/packages/skills/skills/15_Others/neuroimaging-sample-size-calculator/SKILL.md at commit e9ddc112cab9b1c6272dae0c8a6bdceb5c9c3880. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
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.
Review the “Step-by-Step Procedure” section in the pinned source before continuing.
Source: Mumford & Nichols, 2008; Poldrack et al., 2017.
For ROI-based analysis: 1. Define the ROI a priori (from atlas, meta-analysis, or independent data) 2. Extract the mean effect size (Cohen's d or percent signal change) from the pilot data within the ROI 3. Apply the deflation correction (multiply by 0.5-0.75) for conservative e…
For each candidate sample size N:
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 91/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 463 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Traditional power analysis (e.g., using G*Power for a t-test) fails for neuroimaging because it cannot account for the massive multiple comparisons problem, spatial correlation structure, or the multi-level nature of neuroimaging inference. Neuroimaging requires simulation-based approaches that generate synthetic datasets, apply the full analysis pipeline including multiple comparison correction, and estimate power as the proportion of simulations detecting the effect.
A competent programmer without neuroimaging training would use standard power formulas and dramatically overestimate the power of a whole-brain analysis. They would not know that cluster-extent thresholds, random field theory corrections, and spatial smoothness all affect the effective number of tests, nor that pilot-data-based simulation is the gold standard for neuroimaging power analysis. This skill encodes the domain-specific methodology for simulation-based sample size planning.
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.
Standard power analysis computes the sample size for a single statistical test at a given effect size, alpha, and power. Neuroimaging violates every assumption of this framework:
| Standard Assumption | Neuroimaging Reality | Consequence |
|---|---|---|
| Single test | ~100,000 voxels tested | Alpha must be corrected, dramatically reducing per-test sensitivity |
| Independent tests | Voxels are spatially correlated (due to smoothing and neural organization) | Effective number of tests is much less than 100,000, but hard to compute analytically |
| Known effect size | Effect size varies across voxels and depends on ROI definition | No single "effect size" characterizes a study |
| Simple test statistic | Cluster-based, TFCE, and permutation tests have complex null distributions | Power depends on the specific inference method used |
| One-level inference | Subject-level estimation + group-level test | Within-subject variance and between-subject variance both affect power |
Source: Mumford & Nichols, 2008; Poldrack et al., 2017.
The gold standard for neuroimaging power analysis uses pilot data to simulate full datasets at varying sample sizes (Mumford & Nichols, 2008).
Step 1: Obtain pilot data or published effect-size maps
|
Step 2: Estimate expected effect sizes at regions of interest
|
Step 3: Simulate datasets with varying N
|
Step 4: Apply full analysis pipeline (including multiple comparison correction)
|
Step 5: Compute power = proportion of simulations detecting the effect
|
Step 6: Find the N that achieves target power (typically 80% or 90%)
| Source | Quality | Requirements | Caveats |
|---|---|---|---|
| Own pilot study | Best | At least 10-15 subjects for stable variance estimates | Effect sizes from small pilots are inflated; use conservative estimates |
| Published group map | Good | Unthresholded statistical map (t-map or z-map) | May not match your exact paradigm or population |
| NeuroVault repository | Good | Search for comparable paradigms | Maps may use different preprocessing/analysis pipelines |
| Meta-analytic map (NeuroSynth, NiMARE) | Moderate | Coordinate-based or image-based meta-analysis | Provides average effect across studies, may underestimate for specific paradigms |
Source: Mumford & Nichols, 2008; Poldrack et al., 2017.
Critical warning: Effect sizes from small pilot studies (N < 20) are inflated due to the winner's curse. Assume the true effect is 50-75% of the pilot estimate (Button et al., 2013).
For ROI-based analysis:
For whole-brain analysis:
For each candidate sample size N:
Generate 1,000-5,000 simulated group maps by: a. Sampling N subjects from a population with the estimated effect size and variance b. Adding realistic noise (estimated from pilot residuals or assumed Gaussian with spatial smoothness matching the pilot data) c. Creating a group-level statistical map
Apply the smoothness estimate from the pilot data (or the planned smoothing kernel) to each simulated map
For each simulated dataset:
Report the power metric most relevant to your planned analysis (Mumford & Nichols, 2008).
| Feature | Description |
|---|---|
| Input | Pilot group-level statistical maps (from FSL) |
| Method | Resamples from pilot to estimate power at varying N |
| Output | Power curves for specified ROIs at different sample sizes |
| Requirements | FSL, R; pilot data from at least 10-15 subjects |
| Strengths | Uses actual pilot data; accounts for design-specific temporal autocorrelation |
| Limitations | Assumes pilot effect sizes are representative; FSL-specific |
| Feature | Description |
|---|---|
| Input | Unthresholded statistical map (any software) |
| Method | Fits mixture model to peak distribution; estimates prevalence and effect size |
| Output | Power estimates at varying N; optimal sample size for target power |
| Access | Web-based: https://neuropowertools.org |
| Strengths | Does not require individual subject data; works with published maps |
| Limitations | Peak-based approximation; may underestimate power for distributed effects |
| Feature | Description |
|---|---|
| Input | Assumed effect size map, noise model, smoothness |
| Method | Full simulation with parametric statistical testing |
| Output | Voxelwise power maps at specified N |
| Requirements | MATLAB |
| Strengths | Voxel-level power visualization; flexible correction methods |
| Limitations | Computationally intensive; requires specification of noise model |
| Feature | Description |
|---|---|
| Input | Smoothness estimates (from 3dFWHMx), voxel dimensions, mask |
| Method | Monte Carlo simulation of random fields |
| Output | Cluster-size thresholds for a given alpha level |
| Use for power | Estimate minimum detectable cluster size at a given sample size; not a full power tool |
| Strengths | Fast, accounts for non-Gaussian smoothness (ACF model; Cox et al., 2017) |
| Limitations | Does not compute power directly; only provides cluster-extent thresholds |
When full simulation is impractical, ROI-based power analysis provides a reasonable alternative:
| Published Statistic | Conversion to Cohen's d | Source |
|---|---|---|
| t-value (within-subject) | d = t / sqrt(N) | Standard formula |
| t-value (between-group) | d = 2t / sqrt(df) | Standard formula |
| z-value | d = z / sqrt(N) (approximate) | Approximate for large N |
| Percent signal change + SD | d = mean_PSC / SD_PSC | Direct computation |
| Partial eta-squared | d = sqrt(eta^2 / (1 - eta^2)) | Conversion formula |
Use coordinate-based meta-analysis tools to estimate effect sizes at specific brain locations:
| Tool | Method | Output | Source |
|---|---|---|---|
| NiMARE | ALE, MKDA, or other CBMA | Meta-analytic map; extract effect at ROI | Salo et al., 2023 |
| NeuroSynth | Automated term-based meta-analysis | Association maps; extract effect at coordinates | Yarkoni et al., 2011 |
| BrainMap | ALE meta-analysis | Coordinate-based likelihood maps | Laird et al., 2005 |
Caveat: Meta-analytic effect sizes aggregate across many studies with different designs, populations, and analysis pipelines. They provide a reasonable lower bound but may not match your specific paradigm (Yarkoni et al., 2011).
| Finding | Recommendation | Source |
|---|---|---|
| Brain-behavior associations require massive samples for replicability | N > 2,000 for whole-brain brain-behavior correlations | Marek et al., 2022 |
| N = 20 gives ~50% power for medium fMRI effects | N = 40+ for 80% power with medium effects | Poldrack et al., 2017 |
| 80% power at uncorrected p < 0.001 requires N ~ 40 for d = 0.8 | N = 40 per group for large between-group effects | Turner et al., 2018 |
| Cluster-based inference with CDT p < 0.01 produces inflated false positives | Use CDT p < 0.001 and increase N to compensate for reduced sensitivity | Eklund et al., 2016 |
| Within-subject designs are much more powerful than between-subject | Prefer within-subject designs when scientifically appropriate | Mumford & Nichols, 2008 |
| Analysis Type | Minimum N (80% Power) | Effect Size Assumed | Correction Method | Source |
|---|---|---|---|---|
| Within-subject activation (whole-brain) | 25-30 | d = 0.8 (large) | Cluster-based, CDT p < 0.001 | Desmond & Glover, 2002 |
| Between-group (whole-brain, large effect) | 20-25 per group | d = 0.8 | Cluster-based, CDT p < 0.001 | Thirion et al., 2007 |
| Between-group (whole-brain, medium effect) | 40-50 per group | d = 0.5 | Cluster-based, CDT p < 0.001 | Poldrack et al., 2017 |
| ROI-based (single a priori ROI) | 15-25 | d = 0.5-0.8 | Uncorrected (single test) | Desmond & Glover, 2002 |
| Resting-state connectivity (group mean) | 25-40 | r = 0.3-0.5 | FDR or NBS | Smith et al., 2011 |
| Brain-behavior correlation (whole-brain) | 2,000+ | r < 0.1 (replicable) | Permutation | Marek et al., 2022 |
| Brain-behavior correlation (single ROI) | 80-200 | r = 0.2-0.3 | Uncorrected | Standard formula |
Registered reports require pre-specification of sample size with a formal power analysis. For neuroimaging registered reports:
Domain insight: Reviewers will be suspicious of power analyses based on large effect sizes from small pilot studies. Use conservative (deflated) effect size estimates and show power curves across a range of plausible effect sizes.
See references/ for worked examples and simulation code templates.
Frequently asked questions
Simulation-based sample-size planning for neuroimaging studies using effect-size maps
The source record exposes this install command: npx skills add https://github.com/NeuroAIHub/BrainPilot --skill "packages/skills/skills/15_Others/neuroimaging-sample-size-calculator". Inspect the command and pinned source before running it.
Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
coreyhaines31/marketingskills
When the user wants to reduce churn, build cancellation flows, set up save offers, recover failed payments, or implement retention strategies. Also use when the user mentions 'churn,' 'cancel flow,' 'offboarding,' 'save offer,' 'dunning,' 'failed payment recovery,' 'win-back,' 'retention,' 'exit survey,' 'pause subscription,' 'involuntary churn,' 'people keep canceling,' 'churn rate is too high,' 'how do I keep users,' or 'customers are leaving.' Use this whenever someone is losing subscribers o
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
wanshuiyin/Auto-claude-code-research-in-sleep
Use it for operations and research tasks; the detail page covers purpose, installation, and practical steps.