@brainpilot/skills 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
- package/skills/01_Meta-Skills/contribute-skill/SKILL.md +277 -0
- package/skills/01_Meta-Skills/contribute-skills-via-pr/SKILL.md +163 -0
- package/skills/01_Meta-Skills/paper-to-skill/SKILL.md +435 -0
- package/skills/01_Meta-Skills/paper-to-skill/references/extraction-guide.md +286 -0
- package/skills/01_Meta-Skills/paper-to-skill/references/skill-template.md +250 -0
- package/skills/01_Meta-Skills/repo-to-skill/SKILL.md +289 -0
- package/skills/01_Meta-Skills/share-case/SKILL.md +253 -0
- package/skills/01_Meta-Skills/share-usage/README.md +63 -0
- package/skills/01_Meta-Skills/share-usage/SKILL.md +395 -0
- package/skills/01_Meta-Skills/verify-skill/SKILL.md +331 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/SKILL.md +194 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/references/effect-sizes.md +352 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/references/sample-size-guide.md +407 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-statistics/SKILL.md +361 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-statistics/references/common-analyses.md +517 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-visualization/SKILL.md +292 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-visualization/references/plot-recipes.md +709 -0
- package/skills/02_Cross-Domain_Foundation/research-literacy/SKILL.md +286 -0
- package/skills/02_Cross-Domain_Foundation/research-literacy/references/common-assumptions.md +320 -0
- package/skills/02_Cross-Domain_Foundation/research-literacy/references/planning-template.md +143 -0
- package/skills/03_Cognitive_Psychology/alternative-uses-task-designer/SKILL.md +197 -0
- package/skills/03_Cognitive_Psychology/alternative-uses-task-designer/references/instruction-templates.md +60 -0
- package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/SKILL.md +246 -0
- package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/references/classic-paradigms.md +435 -0
- package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/references/design-principles.md +256 -0
- package/skills/03_Cognitive_Psychology/creativity-self-efficacy-mediation/SKILL.md +270 -0
- package/skills/03_Cognitive_Psychology/creativity-self-efficacy-mediation/references/lavaan-templates.md +172 -0
- package/skills/03_Cognitive_Psychology/divergent-thinking-scoring/SKILL.md +238 -0
- package/skills/03_Cognitive_Psychology/divergent-thinking-scoring/references/scoring-rubric.md +143 -0
- package/skills/03_Cognitive_Psychology/drift-diffusion-model/SKILL.md +203 -0
- package/skills/03_Cognitive_Psychology/drift-diffusion-model/references/fitting-guide.md +571 -0
- package/skills/03_Cognitive_Psychology/drift-diffusion-model/references/model-variants.md +427 -0
- package/skills/03_Cognitive_Psychology/evidence-accumulation-selector/SKILL.md +310 -0
- package/skills/03_Cognitive_Psychology/evidence-accumulation-selector/references/ez-diffusion-formulas.md +137 -0
- package/skills/03_Cognitive_Psychology/signal-detection-analysis/SKILL.md +300 -0
- package/skills/03_Cognitive_Psychology/signal-detection-analysis/references/application-guide.md +278 -0
- package/skills/03_Cognitive_Psychology/signal-detection-analysis/references/sdt-formulas.md +318 -0
- package/skills/03_Cognitive_Psychology/visual-search-array-generator/SKILL.md +283 -0
- package/skills/03_Cognitive_Psychology/visual-search-array-generator/references/array-generation-parameters.yaml +111 -0
- package/skills/04_Psycholinguistics/reading-time-analysis/SKILL.md +301 -0
- package/skills/04_Psycholinguistics/reading-time-analysis/references/measure-computation-guide.md +195 -0
- package/skills/04_Psycholinguistics/self-paced-reading-designer/SKILL.md +257 -0
- package/skills/04_Psycholinguistics/self-paced-reading-designer/references/analysis-guide.md +356 -0
- package/skills/04_Psycholinguistics/self-paced-reading-designer/references/region-segmentation.md +266 -0
- package/skills/04_Psycholinguistics/sentence-stimulus-norming/SKILL.md +346 -0
- package/skills/04_Psycholinguistics/sentence-stimulus-norming/references/lexical-databases-guide.md +184 -0
- package/skills/05_EEG_ERP/eeg-paradigm-designer/SKILL.md +226 -0
- package/skills/05_EEG_ERP/eeg-paradigm-designer/references/component-paradigm-map.md +276 -0
- package/skills/05_EEG_ERP/eeg-paradigm-designer/references/timing-parameters.md +244 -0
- package/skills/05_EEG_ERP/eeg-preprocessing-pipeline-guide/SKILL.md +367 -0
- package/skills/05_EEG_ERP/eeg-preprocessing-pipeline-guide/references/parameter-lookup-tables.md +138 -0
- package/skills/05_EEG_ERP/erp-analysis/SKILL.md +185 -0
- package/skills/05_EEG_ERP/erp-analysis/references/erp-components.md +447 -0
- package/skills/05_EEG_ERP/erp-analysis/references/preprocessing-pipeline.md +277 -0
- package/skills/05_EEG_ERP/erp-analysis/references/statistical-approaches.md +351 -0
- package/skills/05_EEG_ERP/mne-python-guide/SKILL.md +174 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/decoding.md +178 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/io_formats.md +160 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/preprocessing.md +259 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/simulation.md +173 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/source_localization.md +234 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/statistics.md +196 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/time_frequency.md +165 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/visualization.md +175 -0
- package/skills/06_fMRI_Neuroimaging/brain-connectivity-modeler/SKILL.md +317 -0
- package/skills/06_fMRI_Neuroimaging/brain-connectivity-modeler/references/method-implementation-guide.md +116 -0
- package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/SKILL.md +296 -0
- package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/references/design-matrix-guide.md +214 -0
- package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/references/statistical-inference.md +288 -0
- package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/SKILL.md +274 -0
- package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/references/quality-control.md +336 -0
- package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/references/step-by-step-pipeline.md +380 -0
- package/skills/06_fMRI_Neuroimaging/fmri-task-design-guide/SKILL.md +264 -0
- package/skills/06_fMRI_Neuroimaging/fmri-task-design-guide/references/design-optimization-examples.md +114 -0
- package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/SKILL.md +273 -0
- package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/references/decoding-methods.md +170 -0
- package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/references/rsa-guide.md +266 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/SKILL.md +123 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/database-subjects.md +179 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/dataset-types.md +208 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/freesurfer-fmriprep.md +162 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/mapping-transforms.md +181 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/mni-utils.md +207 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/surface-analysis.md +219 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/visualization.md +251 -0
- package/skills/07_Computational_Modeling/act-r-model-builder/SKILL.md +297 -0
- package/skills/07_Computational_Modeling/act-r-model-builder/references/model-patterns.md +197 -0
- package/skills/07_Computational_Modeling/act-r-model-builder/references/parameter-table.yaml +204 -0
- package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/SKILL.md +294 -0
- package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/references/diagnostics-checklist.md +351 -0
- package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/references/prior-selection-guide.md +241 -0
- package/skills/07_Computational_Modeling/parameter-recovery-checker/SKILL.md +269 -0
- package/skills/07_Computational_Modeling/parameter-recovery-checker/references/recovery-diagnostics.md +207 -0
- package/skills/08_Computational_Neuroscience/brain-connectivity-modeler/SKILL.md +317 -0
- package/skills/08_Computational_Neuroscience/brain-connectivity-modeler/references/method-implementation-guide.md +116 -0
- package/skills/08_Computational_Neuroscience/neural-decoding-analysis/SKILL.md +273 -0
- package/skills/08_Computational_Neuroscience/neural-decoding-analysis/references/decoding-methods.md +170 -0
- package/skills/08_Computational_Neuroscience/neural-decoding-analysis/references/rsa-guide.md +266 -0
- package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/SKILL.md +305 -0
- package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/references/data-requirements.md +60 -0
- package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/references/method-comparison.md +151 -0
- package/skills/08_Computational_Neuroscience/spiking-network-model-builder/SKILL.md +376 -0
- package/skills/08_Computational_Neuroscience/spiking-network-model-builder/references/hh-parameters.md +117 -0
- package/skills/08_Computational_Neuroscience/spiking-network-model-builder/references/network-regimes.md +130 -0
- package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/SKILL.md +258 -0
- package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/references/indicator-parameters.md +242 -0
- package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/references/pipeline-details.md +211 -0
- package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/SKILL.md +261 -0
- package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/references/opsin-catalog.md +124 -0
- package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/references/stimulation-parameters.md +304 -0
- package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/SKILL.md +367 -0
- package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/references/disconnection-guide.md +152 -0
- package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/references/vlsm-pipeline.md +182 -0
- package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/SKILL.md +250 -0
- package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/references/deficit-profiles.md +302 -0
- package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/references/test-catalog.md +304 -0
- package/skills/11_Developmental_Cognition/infant-looking-time-designer/SKILL.md +345 -0
- package/skills/11_Developmental_Cognition/infant-looking-time-designer/references/age-parameters.yaml +186 -0
- package/skills/12_Social_Cognition/tom-task-selector/SKILL.md +379 -0
- package/skills/12_Social_Cognition/tom-task-selector/references/task-database.md +317 -0
- package/skills/13_Visualization/nature-figure/README.md +442 -0
- package/skills/13_Visualization/nature-figure/SKILL.md +60 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-01-bar-charts.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-02-line-trends.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-03-heatmaps.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-04-scatter-bubble.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-05-radar-polar.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-06-distributions.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-07-forest-interval.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-08-area-stacked.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-09-image-plates.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-10-network-matrix.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_motivation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_observation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_observation_distillation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_contrastive.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_results_CEDAR.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_results_IEDB.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_schematic.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/RNAGenScape_schematic.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/figures/ablation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/figures/comparison.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/plot_ablation.py +86 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/plot_comparison.py +109 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/diffusion_swiss_roll.py +97 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/diffusion_swiss_roll.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.pdf +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.pdf +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.pdf +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_Ablation.py +64 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_GeneRegulatory.py +74 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_Trajectory.py +74 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/figures/idea.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/figures/illustration.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/plot_idea.py +76 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/plot_illustration.py +404 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_FPGM/figures/freq_prior.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_FPGM/plot_freq_prior.py +146 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_ablation_Cancer.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_ablation_IEDB.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_comparison_Cancer.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_comparison_IEDB.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/plot_bars.py +216 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/raw_data.py +125 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/manifold.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/manifold_holes.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_comparison_optimization.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_comparison_speed.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_sweep.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_comparison.py +228 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_hole_manifold.py +82 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_manifold.py +61 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_sweep.py +77 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/figures/comparison_posttraining.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/figures/comparison_radar.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/plot_comparison_radar.py +173 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/plot_posttraining.py +82 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/brute_force.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/correctness_by_category.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/correctness_by_subcategory.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/rewriting.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/selfcorrection_math.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_brute_force.py +248 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_correctness_by_category.py +132 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_correctness_by_subcategory.py +131 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_rewriting.py +105 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_selfcorrection_math.py +99 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/figures/composition_heatmap.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/figures/trend_by_month.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/plot_composition.py +81 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/plot_trend.py +125 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig1-material-mechanism-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig2-spatial-imaging-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig3-in-vivo-efficacy-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig4-single-cell-systems-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig5-validation-perturbation-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/evals/evals.json +37 -0
- package/skills/13_Visualization/nature-figure/manifest.yaml +57 -0
- package/skills/13_Visualization/nature-figure/references/api.md +428 -0
- package/skills/13_Visualization/nature-figure/references/backend-selection.md +100 -0
- package/skills/13_Visualization/nature-figure/references/chart-types.md +281 -0
- package/skills/13_Visualization/nature-figure/references/common-patterns.md +350 -0
- package/skills/13_Visualization/nature-figure/references/demos.md +65 -0
- package/skills/13_Visualization/nature-figure/references/design-theory.md +436 -0
- package/skills/13_Visualization/nature-figure/references/figure-contract.md +93 -0
- package/skills/13_Visualization/nature-figure/references/nature-2026-observations.md +112 -0
- package/skills/13_Visualization/nature-figure/references/qa-contract.md +119 -0
- package/skills/13_Visualization/nature-figure/references/r-template-index.md +66 -0
- package/skills/13_Visualization/nature-figure/references/r-workflow.md +161 -0
- package/skills/13_Visualization/nature-figure/references/tutorials.md +251 -0
- package/skills/13_Visualization/nature-figure/static/core/contract.md +29 -0
- package/skills/13_Visualization/nature-figure/static/core/stance.md +37 -0
- package/skills/13_Visualization/nature-figure/static/fragments/backend/python.md +37 -0
- package/skills/13_Visualization/nature-figure/static/fragments/backend/r.md +44 -0
- package/skills/14_Writing/markdown-report-writing/SKILL.md +306 -0
- package/skills/14_Writing/markdown-report-writing/references/compatibility-matrix.md +72 -0
- package/skills/14_Writing/markdown-report-writing/references/templates.md +299 -0
- package/skills/15_Others/neuroimaging-power-guide/SKILL.md +324 -0
- package/skills/15_Others/neuroimaging-power-guide/references/effect-size-lookup-tables.md +102 -0
- package/skills/15_Others/neuroimaging-sample-size-calculator/SKILL.md +330 -0
- package/skills/15_Others/neuroimaging-sample-size-calculator/references/worked-examples.md +220 -0
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
# Visualization Recipes for Cognitive Science
|
|
2
|
+
|
|
3
|
+
Concrete code recipes for common cognitive science figures. Each recipe specifies: when to use, tool (Python/R), key parameters, APA formatting tips, and common mistakes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Recipe 1: RT Distribution -- Raincloud Plot
|
|
8
|
+
|
|
9
|
+
### When to Use
|
|
10
|
+
- Visualizing reaction time distributions across conditions
|
|
11
|
+
- Any continuous dependent variable where distribution shape matters
|
|
12
|
+
- Replacing bar charts in manuscripts (Allen et al., 2019; Weissgerber et al., 2015)
|
|
13
|
+
|
|
14
|
+
### R Code (ggrain)
|
|
15
|
+
|
|
16
|
+
```r
|
|
17
|
+
library(ggplot2)
|
|
18
|
+
library(ggrain)
|
|
19
|
+
|
|
20
|
+
p <- ggplot(d, aes(x = condition, y = RT, fill = condition, color = condition)) +
|
|
21
|
+
geom_rain(
|
|
22
|
+
rain.side = "l", # Density on left
|
|
23
|
+
point.args = list(size = 1, alpha = 0.3),
|
|
24
|
+
boxplot.args = list(width = 0.1, outlier.shape = NA),
|
|
25
|
+
violin.args = list(alpha = 0.5)
|
|
26
|
+
) +
|
|
27
|
+
scale_fill_manual(values = c("#E69F00", "#56B4E9", "#009E73")) + # Okabe-Ito
|
|
28
|
+
scale_color_manual(values = c("#E69F00", "#56B4E9", "#009E73")) +
|
|
29
|
+
labs(x = "Condition", y = "Reaction time (ms)") +
|
|
30
|
+
theme_classic(base_size = 12) +
|
|
31
|
+
theme(
|
|
32
|
+
legend.position = "none",
|
|
33
|
+
axis.text = element_text(size = 10),
|
|
34
|
+
axis.title = element_text(size = 12)
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
ggsave("rt_raincloud.tiff", p, width = 3.3, height = 3.3, dpi = 300, units = "in")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Python Code (PtitPrince)
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import ptitprince as pt
|
|
44
|
+
import matplotlib.pyplot as plt
|
|
45
|
+
import matplotlib
|
|
46
|
+
matplotlib.rcParams['font.family'] = 'Arial'
|
|
47
|
+
matplotlib.rcParams['font.size'] = 10
|
|
48
|
+
|
|
49
|
+
fig, ax = plt.subplots(figsize=(3.3, 3.3), dpi=300)
|
|
50
|
+
|
|
51
|
+
pt.RainCloud(
|
|
52
|
+
x="condition", y="RT", data=d, ax=ax,
|
|
53
|
+
palette=["#E69F00", "#56B4E9", "#009E73"], # Okabe-Ito (Okabe & Ito, 2002)
|
|
54
|
+
bw=0.2, # Bandwidth for density estimation
|
|
55
|
+
width_viol=0.6,
|
|
56
|
+
point_size=2,
|
|
57
|
+
alpha=0.5,
|
|
58
|
+
orient="v",
|
|
59
|
+
move=0.2
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
ax.set_xlabel("Condition")
|
|
63
|
+
ax.set_ylabel("Reaction time (ms)")
|
|
64
|
+
ax.spines[['top', 'right']].set_visible(False)
|
|
65
|
+
|
|
66
|
+
fig.tight_layout()
|
|
67
|
+
fig.savefig("rt_raincloud.tiff", dpi=300, format='tiff')
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Key Parameters
|
|
71
|
+
- **Bandwidth (bw)**: Controls smoothness of density. Too narrow = noisy; too wide = oversmoothed. Default (Silverman's rule) is usually acceptable.
|
|
72
|
+
- **Point alpha**: **0.2-0.4** for large N (> 50 per condition); **0.5-0.8** for small N (< 30)
|
|
73
|
+
- **Colors**: Use Okabe-Ito palette for colorblind safety (Okabe & Ito, 2002)
|
|
74
|
+
|
|
75
|
+
### APA Formatting Tips
|
|
76
|
+
- Width: **3.3 in** (single column) or **6.9 in** (double column)
|
|
77
|
+
- Font: Arial or Helvetica, **10-12 pt** in final printed size
|
|
78
|
+
- Caption: "Raincloud plot showing RT distributions by condition. Points represent individual trials/participants. Box plots show median and IQR. Density estimates show distribution shape."
|
|
79
|
+
|
|
80
|
+
### Common Mistakes
|
|
81
|
+
- Not jittering points sufficiently (creates a solid line instead of visible scatter)
|
|
82
|
+
- Using bar charts instead because "that's what my advisor always uses"
|
|
83
|
+
- Not specifying what individual points represent (trials? participant means?)
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Recipe 2: ERP Waveform Plot
|
|
88
|
+
|
|
89
|
+
### When to Use
|
|
90
|
+
- Comparing ERP waveforms across conditions at a specific electrode or ROI
|
|
91
|
+
- Showing temporal dynamics of brain responses
|
|
92
|
+
|
|
93
|
+
### Python Code (MNE-Python)
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import mne
|
|
97
|
+
import matplotlib.pyplot as plt
|
|
98
|
+
import matplotlib
|
|
99
|
+
matplotlib.rcParams['font.family'] = 'Arial'
|
|
100
|
+
matplotlib.rcParams['font.size'] = 10
|
|
101
|
+
|
|
102
|
+
fig, ax = plt.subplots(figsize=(4.5, 3.0), dpi=300)
|
|
103
|
+
|
|
104
|
+
# Plot evoked responses for each condition
|
|
105
|
+
colors = {"congruent": "#0072B2", "incongruent": "#D55E00"} # Okabe-Ito subset
|
|
106
|
+
linestyles = {"congruent": "-", "incongruent": "--"}
|
|
107
|
+
|
|
108
|
+
for cond, evoked in evoked_dict.items():
|
|
109
|
+
times = evoked.times * 1000 # Convert to ms
|
|
110
|
+
data = evoked.data[channel_idx, :] * 1e6 # Convert to uV
|
|
111
|
+
|
|
112
|
+
ax.plot(times, data,
|
|
113
|
+
color=colors[cond], linestyle=linestyles[cond],
|
|
114
|
+
linewidth=1.5, label=cond)
|
|
115
|
+
|
|
116
|
+
# Convention: negative up (traditional ERP; Luck, 2014)
|
|
117
|
+
ax.invert_yaxis()
|
|
118
|
+
|
|
119
|
+
# Mark stimulus onset
|
|
120
|
+
ax.axvline(x=0, color='black', linestyle=':', linewidth=0.5)
|
|
121
|
+
ax.axhline(y=0, color='black', linestyle='-', linewidth=0.5)
|
|
122
|
+
|
|
123
|
+
# Shade component window (e.g., N400: 300-500 ms; Kutas & Federmeier, 2011)
|
|
124
|
+
ax.axvspan(300, 500, alpha=0.1, color='gray', label='N400 window')
|
|
125
|
+
|
|
126
|
+
# Shade baseline
|
|
127
|
+
ax.axvspan(-200, 0, alpha=0.05, color='gray')
|
|
128
|
+
|
|
129
|
+
ax.set_xlabel("Time (ms)")
|
|
130
|
+
ax.set_ylabel("Amplitude (uV)")
|
|
131
|
+
ax.set_xlim([-200, 800])
|
|
132
|
+
ax.legend(loc='lower right', fontsize=8, frameon=False)
|
|
133
|
+
ax.spines[['top', 'right']].set_visible(False)
|
|
134
|
+
|
|
135
|
+
fig.tight_layout()
|
|
136
|
+
fig.savefig("erp_waveform.tiff", dpi=300, format='tiff')
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### R Code (ggplot2)
|
|
140
|
+
|
|
141
|
+
```r
|
|
142
|
+
library(ggplot2)
|
|
143
|
+
|
|
144
|
+
p <- ggplot(erp_data, aes(x = time_ms, y = amplitude_uv, color = condition,
|
|
145
|
+
linetype = condition)) +
|
|
146
|
+
geom_line(linewidth = 0.8) +
|
|
147
|
+
geom_vline(xintercept = 0, linetype = "dotted", linewidth = 0.5) +
|
|
148
|
+
geom_hline(yintercept = 0, linewidth = 0.5) +
|
|
149
|
+
annotate("rect", xmin = 300, xmax = 500, ymin = -Inf, ymax = Inf,
|
|
150
|
+
alpha = 0.1, fill = "gray") +
|
|
151
|
+
scale_y_reverse() + # Negative up (Luck, 2014)
|
|
152
|
+
scale_color_manual(values = c("#0072B2", "#D55E00")) + # Okabe-Ito
|
|
153
|
+
labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)"))) +
|
|
154
|
+
theme_classic(base_size = 10) +
|
|
155
|
+
theme(legend.position = c(0.8, 0.2), legend.background = element_blank())
|
|
156
|
+
|
|
157
|
+
ggsave("erp_waveform.tiff", p, width = 4.5, height = 3.0, dpi = 300, units = "in")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Key Parameters
|
|
161
|
+
- **Line width**: **1.0-1.5 pt** for waveforms (Luck, 2014)
|
|
162
|
+
- **Time range**: Typically **-200 to 800 ms** (adjust for paradigm)
|
|
163
|
+
- **Y-axis direction**: Invert for negative-up convention
|
|
164
|
+
- **Component shading**: Use named time windows from literature (e.g., N400: **300-500 ms**; Kutas & Federmeier, 2011)
|
|
165
|
+
|
|
166
|
+
### APA Formatting Tips
|
|
167
|
+
- Caption: "Grand-averaged ERP waveforms at electrode [Cz/Pz/etc.] for [condition names]. Negative is plotted upward. Shaded region indicates the [component] time window ([start]-[end] ms). N = [number]."
|
|
168
|
+
- Always state polarity convention, electrode, and number of participants
|
|
169
|
+
|
|
170
|
+
### Common Mistakes
|
|
171
|
+
- Not stating polarity convention (negative up vs. down)
|
|
172
|
+
- Using different y-axis scales across panels without noting it
|
|
173
|
+
- Not showing stimulus onset marker
|
|
174
|
+
- Plotting only group averages without any indication of variability
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Recipe 3: ERP Topographic Map
|
|
179
|
+
|
|
180
|
+
### When to Use
|
|
181
|
+
- Showing scalp distribution of ERP effect at a specific time window
|
|
182
|
+
- Validating that the observed effect has the expected topography for a given component
|
|
183
|
+
|
|
184
|
+
### Python Code (MNE-Python)
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
import mne
|
|
188
|
+
import matplotlib.pyplot as plt
|
|
189
|
+
|
|
190
|
+
fig, axes = plt.subplots(1, 3, figsize=(6.9, 2.5), dpi=300)
|
|
191
|
+
|
|
192
|
+
# Time windows for topographic maps
|
|
193
|
+
time_windows = {
|
|
194
|
+
"N1 (80-120 ms)": (0.080, 0.120),
|
|
195
|
+
"N400 (300-500 ms)": (0.300, 0.500),
|
|
196
|
+
"P600 (500-800 ms)": (0.500, 0.800)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
for ax, (label, (tmin, tmax)) in zip(axes, time_windows.items()):
|
|
200
|
+
# Compute mean amplitude in time window
|
|
201
|
+
evoked_diff = mne.combine_evoked(
|
|
202
|
+
[evoked_cond_a, evoked_cond_b], weights=[1, -1]
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
evoked_diff.plot_topomap(
|
|
206
|
+
times=[(tmin + tmax) / 2],
|
|
207
|
+
average=(tmax - tmin),
|
|
208
|
+
axes=ax,
|
|
209
|
+
colorbar=False,
|
|
210
|
+
cmap='RdBu_r', # Diverging colormap (Crameri et al., 2020)
|
|
211
|
+
vlim=(-3, 3), # Symmetric limits in uV
|
|
212
|
+
show=False
|
|
213
|
+
)
|
|
214
|
+
ax.set_title(label, fontsize=9)
|
|
215
|
+
|
|
216
|
+
# Add shared colorbar
|
|
217
|
+
sm = plt.cm.ScalarMappable(cmap='RdBu_r', norm=plt.Normalize(-3, 3))
|
|
218
|
+
sm.set_array([])
|
|
219
|
+
cbar = fig.colorbar(sm, ax=axes.tolist(), shrink=0.8)
|
|
220
|
+
cbar.set_label('Amplitude (uV)', fontsize=9)
|
|
221
|
+
|
|
222
|
+
fig.tight_layout()
|
|
223
|
+
fig.savefig("erp_topomap.tiff", dpi=300, format='tiff')
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Key Parameters
|
|
227
|
+
- **Colormap**: `RdBu_r` (diverging, blue-white-red, colorblind-safe; Crameri et al., 2020)
|
|
228
|
+
- **Limits (vlim)**: Symmetric around zero; set to capture the range of the data
|
|
229
|
+
- **Time windows**: Use established component windows from literature (see `../cogsci-statistics/references/common-analyses.md`)
|
|
230
|
+
- **Sensor positions**: Show electrode markers on the map
|
|
231
|
+
|
|
232
|
+
### APA Formatting Tips
|
|
233
|
+
- Caption: "Topographic distribution of the [effect name] (condition A minus condition B) at [time windows]. Scale in microvolts. Electrode positions marked as dots."
|
|
234
|
+
- Use consistent color scales across all topographic maps in the same figure
|
|
235
|
+
|
|
236
|
+
### Common Mistakes
|
|
237
|
+
- Using non-diverging colormap for difference data (obscures the zero-crossing)
|
|
238
|
+
- Different color scales across panels within the same figure
|
|
239
|
+
- Not specifying whether the map shows absolute values or condition differences
|
|
240
|
+
- Omitting the color bar
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Recipe 4: fMRI Activation Map
|
|
245
|
+
|
|
246
|
+
### When to Use
|
|
247
|
+
- Showing brain regions activated by a contrast of interest
|
|
248
|
+
- Whole-brain statistical results display
|
|
249
|
+
|
|
250
|
+
### Python Code (nilearn)
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
from nilearn import plotting
|
|
254
|
+
import matplotlib.pyplot as plt
|
|
255
|
+
|
|
256
|
+
# Option 1: Glass brain (whole-brain overview)
|
|
257
|
+
fig = plt.figure(figsize=(6.9, 2.5), dpi=300)
|
|
258
|
+
|
|
259
|
+
display = plotting.plot_glass_brain(
|
|
260
|
+
stat_map_img,
|
|
261
|
+
threshold=3.1, # z = 3.1 ~ p < 0.001 (Eklund et al., 2016)
|
|
262
|
+
colorbar=True,
|
|
263
|
+
cmap='inferno', # Perceptually uniform (Crameri et al., 2020)
|
|
264
|
+
plot_abs=False, # Show both positive and negative
|
|
265
|
+
display_mode='lyrz', # Left, top, right, lateral views
|
|
266
|
+
figure=fig,
|
|
267
|
+
title='Contrast: Task > Rest'
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
fig.savefig("fmri_glass_brain.tiff", dpi=300, format='tiff')
|
|
271
|
+
|
|
272
|
+
# Option 2: Slice montage with anatomical underlay
|
|
273
|
+
fig, axes = plt.subplots(1, 1, figsize=(6.9, 2.0), dpi=300)
|
|
274
|
+
|
|
275
|
+
display = plotting.plot_stat_map(
|
|
276
|
+
stat_map_img,
|
|
277
|
+
bg_img=mni_template, # MNI152 T1 1mm template
|
|
278
|
+
threshold=3.1, # z = 3.1 (Eklund et al., 2016)
|
|
279
|
+
display_mode='z', # Axial slices
|
|
280
|
+
cut_coords=[-20, -5, 10, 25, 40, 55], # Show multiple levels
|
|
281
|
+
colorbar=True,
|
|
282
|
+
cmap='cold_hot', # Diverging for activation/deactivation
|
|
283
|
+
annotate=True, # Show coordinates
|
|
284
|
+
figure=fig
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
fig.savefig("fmri_slices.tiff", dpi=300, format='tiff')
|
|
288
|
+
|
|
289
|
+
# Option 3: Surface projection
|
|
290
|
+
fig, axes = plt.subplots(2, 2, figsize=(6.9, 5.0), dpi=300,
|
|
291
|
+
subplot_kw={'projection': '3d'})
|
|
292
|
+
|
|
293
|
+
for ax, hemi, view in zip(axes.flat,
|
|
294
|
+
['left', 'right', 'left', 'right'],
|
|
295
|
+
['lateral', 'lateral', 'medial', 'medial']):
|
|
296
|
+
plotting.plot_surf_stat_map(
|
|
297
|
+
surf_mesh=f'fsaverage5_{hemi}',
|
|
298
|
+
stat_map=stat_map_surface,
|
|
299
|
+
hemi=hemi,
|
|
300
|
+
view=view,
|
|
301
|
+
threshold=3.1,
|
|
302
|
+
colorbar=True,
|
|
303
|
+
cmap='inferno',
|
|
304
|
+
axes=ax
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
fig.savefig("fmri_surface.tiff", dpi=300, format='tiff')
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Key Parameters
|
|
311
|
+
- **Threshold**: z = **3.1** corresponds to approximately p < 0.001 uncorrected (Eklund et al., 2016 -- minimum for cluster-forming threshold)
|
|
312
|
+
- **Colormap**: `inferno` or `hot` for sequential; `cold_hot` or `RdBu_r` for diverging (Crameri et al., 2020)
|
|
313
|
+
- **Background**: MNI152 T1 **1 mm** template for anatomical detail
|
|
314
|
+
- **Display mode**: `'z'` for axial, `'x'` for sagittal, `'y'` for coronal, `'ortho'` for all three
|
|
315
|
+
|
|
316
|
+
### APA Formatting Tips
|
|
317
|
+
- Caption: "Statistical map showing regions with significantly greater activation for [contrast]. Voxel-level threshold: z > 3.1 (p < 0.001 uncorrected); cluster-level correction: p < 0.05 FWE. Coordinates in MNI space. Color bar indicates z-score."
|
|
318
|
+
- Always report: threshold, correction method, coordinate space, template
|
|
319
|
+
|
|
320
|
+
### Common Mistakes
|
|
321
|
+
- Using jet/rainbow colormap (Borland & Taylor, 2007)
|
|
322
|
+
- Not reporting the threshold in the figure or caption
|
|
323
|
+
- Showing only a single slice that happens to contain the peak voxel
|
|
324
|
+
- Using different thresholds in the figure vs. the statistics reported in the text
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Recipe 5: Behavioral Accuracy -- Dot Plot with Within-Subject CI
|
|
329
|
+
|
|
330
|
+
### When to Use
|
|
331
|
+
- Displaying condition means for accuracy or any proportion in a within-subjects design
|
|
332
|
+
- When standard (between-subject) CIs would be misleading for within-subject comparisons
|
|
333
|
+
|
|
334
|
+
### R Code
|
|
335
|
+
|
|
336
|
+
```r
|
|
337
|
+
library(ggplot2)
|
|
338
|
+
library(Rmisc) # for summarySEwithin
|
|
339
|
+
|
|
340
|
+
# Within-subject summary statistics (Morey, 2008)
|
|
341
|
+
d_summary <- summarySEwithin(d, measurevar = "accuracy",
|
|
342
|
+
withinvars = "condition",
|
|
343
|
+
idvar = "subject")
|
|
344
|
+
|
|
345
|
+
p <- ggplot() +
|
|
346
|
+
# Individual subject data (connected for within-subjects)
|
|
347
|
+
geom_line(data = d, aes(x = condition, y = accuracy, group = subject),
|
|
348
|
+
alpha = 0.2, color = "gray60") +
|
|
349
|
+
geom_point(data = d, aes(x = condition, y = accuracy),
|
|
350
|
+
alpha = 0.3, size = 1, color = "gray40",
|
|
351
|
+
position = position_jitter(width = 0.05)) +
|
|
352
|
+
# Group means with within-subject CI (Morey, 2008)
|
|
353
|
+
geom_pointrange(data = d_summary,
|
|
354
|
+
aes(x = condition, y = accuracy,
|
|
355
|
+
ymin = accuracy - ci, ymax = accuracy + ci),
|
|
356
|
+
size = 0.8, linewidth = 1.0,
|
|
357
|
+
color = "black") +
|
|
358
|
+
labs(x = "Condition", y = "Accuracy (proportion correct)") +
|
|
359
|
+
scale_y_continuous(limits = c(0, 1)) +
|
|
360
|
+
theme_classic(base_size = 11) +
|
|
361
|
+
theme(axis.text = element_text(size = 10))
|
|
362
|
+
|
|
363
|
+
ggsave("accuracy_dotplot.tiff", p, width = 3.3, height = 3.3, dpi = 300, units = "in")
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Python Code
|
|
367
|
+
|
|
368
|
+
```python
|
|
369
|
+
import numpy as np
|
|
370
|
+
import pandas as pd
|
|
371
|
+
import matplotlib.pyplot as plt
|
|
372
|
+
matplotlib.rcParams['font.family'] = 'Arial'
|
|
373
|
+
|
|
374
|
+
# Within-subject CI (Cousineau, 2005; Morey, 2008 correction)
|
|
375
|
+
def within_subject_ci(data, dv, subject, condition, ci=0.95):
|
|
376
|
+
"""Compute within-subject confidence intervals with Morey (2008) correction."""
|
|
377
|
+
# Remove between-subject variance
|
|
378
|
+
subj_means = data.groupby(subject)[dv].transform('mean')
|
|
379
|
+
grand_mean = data[dv].mean()
|
|
380
|
+
data_norm = data.copy()
|
|
381
|
+
data_norm[dv] = data[dv] - subj_means + grand_mean
|
|
382
|
+
|
|
383
|
+
# Compute CI on normalized data
|
|
384
|
+
k = data[condition].nunique()
|
|
385
|
+
correction = np.sqrt(k / (k - 1)) # Morey (2008) correction factor
|
|
386
|
+
|
|
387
|
+
summary = data_norm.groupby(condition)[dv].agg(['mean', 'sem']).reset_index()
|
|
388
|
+
from scipy import stats
|
|
389
|
+
t_crit = stats.t.ppf((1 + ci) / 2, df=data[subject].nunique() - 1)
|
|
390
|
+
summary['ci'] = summary['sem'] * t_crit * correction
|
|
391
|
+
summary['mean_orig'] = data.groupby(condition)[dv].mean().values
|
|
392
|
+
return summary
|
|
393
|
+
|
|
394
|
+
summary = within_subject_ci(d, 'accuracy', 'subject', 'condition')
|
|
395
|
+
|
|
396
|
+
fig, ax = plt.subplots(figsize=(3.3, 3.3), dpi=300)
|
|
397
|
+
|
|
398
|
+
# Individual subjects
|
|
399
|
+
for subj in d['subject'].unique():
|
|
400
|
+
subj_data = d[d['subject'] == subj]
|
|
401
|
+
ax.plot(subj_data['condition'], subj_data['accuracy'],
|
|
402
|
+
color='gray', alpha=0.15, linewidth=0.5)
|
|
403
|
+
|
|
404
|
+
# Group means with within-subject CI
|
|
405
|
+
ax.errorbar(summary['condition'], summary['mean_orig'],
|
|
406
|
+
yerr=summary['ci'], fmt='ko', markersize=6,
|
|
407
|
+
linewidth=1.5, capsize=4)
|
|
408
|
+
|
|
409
|
+
ax.set_xlabel("Condition")
|
|
410
|
+
ax.set_ylabel("Accuracy (proportion correct)")
|
|
411
|
+
ax.set_ylim([0, 1])
|
|
412
|
+
ax.spines[['top', 'right']].set_visible(False)
|
|
413
|
+
|
|
414
|
+
fig.tight_layout()
|
|
415
|
+
fig.savefig("accuracy_dotplot.tiff", dpi=300, format='tiff')
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### Key Parameters
|
|
419
|
+
- **Morey (2008) correction**: Multiply SE by `sqrt(k / (k-1))` where k = number of conditions
|
|
420
|
+
- **Individual data alpha**: **0.15-0.3** (thin, semi-transparent lines connecting within-subject data)
|
|
421
|
+
- **Y-axis range**: [0, 1] for proportions
|
|
422
|
+
|
|
423
|
+
### APA Formatting Tips
|
|
424
|
+
- Caption: "Mean accuracy by condition. Error bars indicate within-subject 95% CI (Morey, 2008). Gray lines connect individual participants' data points. N = [number]."
|
|
425
|
+
- Always specify that CIs are within-subject corrected
|
|
426
|
+
|
|
427
|
+
### Common Mistakes
|
|
428
|
+
- Using between-subject CIs for within-subject comparisons (overestimates variability; Loftus & Masson, 1994)
|
|
429
|
+
- Not connecting individual data points in within-subject designs (connection shows paired structure)
|
|
430
|
+
- Starting y-axis at 0.5 when accuracy is near ceiling (may obscure meaningful variation -- but state the break)
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## Recipe 6: Group Comparison -- Cumming Estimation Plot (DABEST)
|
|
435
|
+
|
|
436
|
+
### When to Use
|
|
437
|
+
- Comparing two or more groups or conditions
|
|
438
|
+
- Emphasizing effect size and uncertainty over p-values
|
|
439
|
+
- "Estimation statistics" approach (Cumming, 2014; Ho et al., 2019)
|
|
440
|
+
|
|
441
|
+
### Python Code (DABEST)
|
|
442
|
+
|
|
443
|
+
```python
|
|
444
|
+
import dabest
|
|
445
|
+
|
|
446
|
+
# Gardner-Altman estimation plot (Ho et al., 2019)
|
|
447
|
+
analysis = dabest.load(d, x="group", y="score",
|
|
448
|
+
idx=("control", "treatment"))
|
|
449
|
+
|
|
450
|
+
fig = analysis.mean_diff.plot(
|
|
451
|
+
color_col="group",
|
|
452
|
+
custom_palette=["#56B4E9", "#E69F00"], # Okabe-Ito
|
|
453
|
+
raw_marker_size=4,
|
|
454
|
+
es_marker_size=8,
|
|
455
|
+
swarm_label="Score",
|
|
456
|
+
contrast_label="Mean difference",
|
|
457
|
+
fig_size=(4.5, 4.0),
|
|
458
|
+
dpi=300
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
fig.savefig("estimation_plot.tiff", dpi=300, format='tiff')
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### R Code (dabestr)
|
|
465
|
+
|
|
466
|
+
```r
|
|
467
|
+
library(dabestr)
|
|
468
|
+
|
|
469
|
+
result <- dabest(d, x = group, y = score,
|
|
470
|
+
idx = c("control", "treatment"),
|
|
471
|
+
paired = FALSE) %>%
|
|
472
|
+
mean_diff()
|
|
473
|
+
|
|
474
|
+
plot(result,
|
|
475
|
+
color.column = group,
|
|
476
|
+
palette = c("control" = "#56B4E9", "treatment" = "#E69F00"),
|
|
477
|
+
rawplot.markersize = 2,
|
|
478
|
+
effsize.markersize = 4) +
|
|
479
|
+
theme_classic(base_size = 10)
|
|
480
|
+
|
|
481
|
+
ggsave("estimation_plot.tiff", width = 4.5, height = 4.0, dpi = 300, units = "in")
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Key Parameters
|
|
485
|
+
- **Bootstrap resamples**: **5000** (default in DABEST; Ho et al., 2019)
|
|
486
|
+
- **Effect size**: Mean difference with 95% CI (default) or Cohen's d
|
|
487
|
+
- **Individual data**: Shown as a swarm plot (left panel)
|
|
488
|
+
|
|
489
|
+
### APA Formatting Tips
|
|
490
|
+
- Caption: "Gardner-Altman estimation plot showing individual data points (left) and the mean difference with bootstrap 95% CI (right). N = [per group]. [Number] bootstrap resamples."
|
|
491
|
+
- The estimation plot naturally communicates effect size and uncertainty
|
|
492
|
+
|
|
493
|
+
### Common Mistakes
|
|
494
|
+
- Not reporting the numerical effect size and CI in the text (the plot supplements but does not replace statistical reporting)
|
|
495
|
+
- Using this for within-subject designs without the paired option
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Recipe 7: Time-Frequency Representation (TFR)
|
|
500
|
+
|
|
501
|
+
### When to Use
|
|
502
|
+
- Visualizing oscillatory power changes over time and frequency
|
|
503
|
+
- Showing event-related spectral perturbation (ERSP)
|
|
504
|
+
|
|
505
|
+
### Python Code (MNE-Python)
|
|
506
|
+
|
|
507
|
+
```python
|
|
508
|
+
import mne
|
|
509
|
+
import matplotlib.pyplot as plt
|
|
510
|
+
|
|
511
|
+
# Compute TFR using Morlet wavelets
|
|
512
|
+
freqs = np.logspace(np.log10(4), np.log10(40), num=30) # 4-40 Hz log-spaced
|
|
513
|
+
n_cycles = freqs / 2 # Frequency-dependent cycles (standard: freq / 2; Cohen, 2014)
|
|
514
|
+
|
|
515
|
+
power = mne.time_frequency.tfr_morlet(
|
|
516
|
+
epochs, freqs=freqs, n_cycles=n_cycles,
|
|
517
|
+
return_itc=False, average=True
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
# Apply baseline correction (dB; Cohen, 2014)
|
|
521
|
+
# Baseline: -500 to -200 ms (avoid edge artifacts)
|
|
522
|
+
power.apply_baseline(baseline=(-0.5, -0.2), mode='logratio')
|
|
523
|
+
|
|
524
|
+
fig, ax = plt.subplots(figsize=(4.5, 3.0), dpi=300)
|
|
525
|
+
|
|
526
|
+
power.plot(
|
|
527
|
+
picks=[channel_idx],
|
|
528
|
+
axes=ax,
|
|
529
|
+
baseline=None, # Already applied
|
|
530
|
+
cmap='RdBu_r', # Diverging for dB change (Crameri et al., 2020)
|
|
531
|
+
vmin=-1.5, vmax=1.5, # Symmetric for diverging map
|
|
532
|
+
show=False
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
ax.set_xlabel("Time (ms)")
|
|
536
|
+
ax.set_ylabel("Frequency (Hz)")
|
|
537
|
+
ax.set_title("") # Remove auto-title; use figure caption instead
|
|
538
|
+
|
|
539
|
+
fig.tight_layout()
|
|
540
|
+
fig.savefig("tfr.tiff", dpi=300, format='tiff')
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Key Parameters
|
|
544
|
+
- **Frequencies**: **4-40 Hz** (or task-specific range) on a log scale (Cohen, 2014)
|
|
545
|
+
- **Wavelet cycles**: `n_cycles = freq / 2` provides balanced time-frequency resolution (Cohen, 2014)
|
|
546
|
+
- **Baseline**: Apply before plotting; use **-500 to -200 ms** to avoid onset contamination (Cohen, 2014)
|
|
547
|
+
- **Baseline mode**: `'logratio'` (decibel, dB) is standard for TFR (Cohen, 2014)
|
|
548
|
+
- **Colormap**: `RdBu_r` (diverging, centered on zero; for baseline-corrected power)
|
|
549
|
+
|
|
550
|
+
### APA Formatting Tips
|
|
551
|
+
- Caption: "Time-frequency representation at electrode [name] showing event-related spectral power (dB relative to baseline [start]-[end] ms). Morlet wavelets with [n_cycles specification]. Warm colors indicate power increase; cool colors indicate power decrease."
|
|
552
|
+
- Always report: baseline period, baseline correction method, wavelet parameters, frequency range
|
|
553
|
+
|
|
554
|
+
### Common Mistakes
|
|
555
|
+
- Not applying baseline correction (raw power values are not interpretable across frequencies)
|
|
556
|
+
- Using a sequential colormap for baseline-corrected data (which has both positive and negative values)
|
|
557
|
+
- Using a linear frequency axis when a log axis would better represent the data (low frequencies are overrepresented)
|
|
558
|
+
- Using fixed n_cycles across all frequencies (poor time resolution at low frequencies or poor frequency resolution at high frequencies)
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## Recipe 8: Correlation Matrix -- Hierarchically Clustered Heatmap
|
|
563
|
+
|
|
564
|
+
### When to Use
|
|
565
|
+
- Visualizing relationships among multiple variables (behavioral measures, neural measures, questionnaire subscales)
|
|
566
|
+
- Identifying clusters of related variables
|
|
567
|
+
|
|
568
|
+
### Python Code (seaborn)
|
|
569
|
+
|
|
570
|
+
```python
|
|
571
|
+
import seaborn as sns
|
|
572
|
+
import matplotlib.pyplot as plt
|
|
573
|
+
from scipy.cluster.hierarchy import linkage
|
|
574
|
+
from scipy.spatial.distance import squareform
|
|
575
|
+
|
|
576
|
+
# Compute correlation matrix
|
|
577
|
+
corr_matrix = d[variable_list].corr()
|
|
578
|
+
|
|
579
|
+
# Hierarchical clustering for ordering
|
|
580
|
+
linkage_matrix = linkage(squareform(1 - corr_matrix.abs()), method='ward')
|
|
581
|
+
|
|
582
|
+
fig, ax = plt.subplots(figsize=(5.0, 4.5), dpi=300)
|
|
583
|
+
|
|
584
|
+
g = sns.clustermap(
|
|
585
|
+
corr_matrix,
|
|
586
|
+
row_linkage=linkage_matrix,
|
|
587
|
+
col_linkage=linkage_matrix,
|
|
588
|
+
cmap='RdBu_r', # Diverging (Crameri et al., 2020)
|
|
589
|
+
vmin=-1, vmax=1, # Full correlation range
|
|
590
|
+
center=0,
|
|
591
|
+
annot=True, # Show correlation values
|
|
592
|
+
fmt='.2f', # Two decimal places
|
|
593
|
+
linewidths=0.5,
|
|
594
|
+
figsize=(5.0, 4.5),
|
|
595
|
+
dendrogram_ratio=(0.15, 0.15),
|
|
596
|
+
cbar_kws={'label': "Pearson's r", 'shrink': 0.8}
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
g.ax_heatmap.set_xticklabels(g.ax_heatmap.get_xticklabels(),
|
|
600
|
+
fontsize=8, rotation=45, ha='right')
|
|
601
|
+
g.ax_heatmap.set_yticklabels(g.ax_heatmap.get_yticklabels(),
|
|
602
|
+
fontsize=8, rotation=0)
|
|
603
|
+
|
|
604
|
+
g.savefig("correlation_heatmap.tiff", dpi=300, format='tiff')
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### R Code (corrplot)
|
|
608
|
+
|
|
609
|
+
```r
|
|
610
|
+
library(corrplot)
|
|
611
|
+
|
|
612
|
+
# Compute correlation matrix
|
|
613
|
+
cor_mat <- cor(d[, variables], use = "pairwise.complete.obs")
|
|
614
|
+
|
|
615
|
+
# Hierarchically clustered heatmap
|
|
616
|
+
tiff("correlation_heatmap.tiff", width = 5, height = 4.5, units = "in", res = 300)
|
|
617
|
+
|
|
618
|
+
corrplot(cor_mat,
|
|
619
|
+
method = "color",
|
|
620
|
+
type = "lower",
|
|
621
|
+
order = "hclust", # Hierarchical clustering order
|
|
622
|
+
hclust.method = "ward.D2",
|
|
623
|
+
col = colorRampPalette(c("#2166AC", "white", "#B2182B"))(200), # RdBu
|
|
624
|
+
tl.col = "black",
|
|
625
|
+
tl.cex = 0.7,
|
|
626
|
+
number.cex = 0.6,
|
|
627
|
+
addCoef.col = "black", # Show correlation values
|
|
628
|
+
cl.cex = 0.7)
|
|
629
|
+
|
|
630
|
+
dev.off()
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### Key Parameters
|
|
634
|
+
- **Colormap**: `RdBu_r` (diverging, centered on zero; Crameri et al., 2020)
|
|
635
|
+
- **Range**: [-1, 1] for correlation matrices
|
|
636
|
+
- **Clustering method**: Ward's method (`ward.D2`) for balanced clusters
|
|
637
|
+
- **Annotation format**: Two decimal places for correlation values
|
|
638
|
+
|
|
639
|
+
### APA Formatting Tips
|
|
640
|
+
- Caption: "Hierarchically clustered correlation matrix of [variable description]. Color indicates Pearson's r. Variables are ordered by Ward's hierarchical clustering. N = [number]."
|
|
641
|
+
- For many variables (> 15), consider showing only significant correlations or using a threshold
|
|
642
|
+
|
|
643
|
+
### Common Mistakes
|
|
644
|
+
- Not centering the colormap on zero (asymmetric colors misrepresent the sign of correlations)
|
|
645
|
+
- Using an unclustered default ordering (misses the modular structure)
|
|
646
|
+
- Annotating with too many decimal places (clutters the figure)
|
|
647
|
+
- Not specifying the correlation type (Pearson vs. Spearman) in the caption
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
## General Tips Across All Recipes
|
|
652
|
+
|
|
653
|
+
### Save Settings for Reproducibility
|
|
654
|
+
|
|
655
|
+
```python
|
|
656
|
+
# Python: Save figure parameters
|
|
657
|
+
FIGURE_PARAMS = {
|
|
658
|
+
'single_col_width': 3.3, # inches (typical journal single column)
|
|
659
|
+
'double_col_width': 6.9, # inches (typical journal double column)
|
|
660
|
+
'dpi': 300, # Minimum for print (APA 7th, 2020)
|
|
661
|
+
'font_family': 'Arial',
|
|
662
|
+
'font_size': 10, # Base font size for final figure
|
|
663
|
+
'line_width': 1.0, # Default line width
|
|
664
|
+
'palette': ["#E69F00", "#56B4E9", "#009E73",
|
|
665
|
+
"#F0E442", "#0072B2", "#D55E00",
|
|
666
|
+
"#CC79A7", "#000000"] # Okabe-Ito (Okabe & Ito, 2002)
|
|
667
|
+
}
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
```r
|
|
671
|
+
# R: Theme for consistent formatting
|
|
672
|
+
theme_publication <- function(base_size = 10) {
|
|
673
|
+
theme_classic(base_size = base_size) +
|
|
674
|
+
theme(
|
|
675
|
+
text = element_text(family = "Arial"),
|
|
676
|
+
axis.text = element_text(size = base_size - 1),
|
|
677
|
+
axis.title = element_text(size = base_size),
|
|
678
|
+
legend.text = element_text(size = base_size - 1),
|
|
679
|
+
strip.text = element_text(size = base_size),
|
|
680
|
+
plot.title = element_text(size = base_size + 1, face = "bold")
|
|
681
|
+
)
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
### Colorblind Testing Checklist
|
|
686
|
+
|
|
687
|
+
Before submitting any figure:
|
|
688
|
+
1. View in grayscale (does the information survive?)
|
|
689
|
+
2. Run through a CVD simulator (deuteranopia and protanopia at minimum)
|
|
690
|
+
3. Verify that color is not the ONLY encoding (use linetype, shape, labels as redundant cues)
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## References
|
|
695
|
+
|
|
696
|
+
- Allen, M., et al. (2019). Raincloud plots. *Wellcome Open Research*, 4, 63.
|
|
697
|
+
- Borland, D., & Taylor, R. M. (2007). Rainbow color map (still) considered harmful. *IEEE CGA*, 27(2), 14-17.
|
|
698
|
+
- Cohen, M. X. (2014). *Analyzing Neural Time Series Data*. MIT Press.
|
|
699
|
+
- Cousineau, D. (2005). Confidence intervals in within-subject designs. *TQMP*, 1(1), 42-45.
|
|
700
|
+
- Crameri, F., et al. (2020). The misuse of colour in science communication. *Nature Communications*, 11, 5444.
|
|
701
|
+
- Cumming, G. (2014). The new statistics. *Psychological Science*, 25(1), 7-29.
|
|
702
|
+
- Eklund, A., et al. (2016). Cluster failure. *PNAS*, 113(28), 7900-7905.
|
|
703
|
+
- Ho, J., Tumkaya, T., Aryal, S., Choi, H., & Claridge-Chang, A. (2019). Moving beyond P values: Data analysis with estimation graphics. *Nature Methods*, 16, 565-566.
|
|
704
|
+
- Kutas, M., & Federmeier, K. D. (2011). Thirty years and counting. *Annual Review of Psychology*, 62, 621-647.
|
|
705
|
+
- Loftus, G. R., & Masson, M. E. J. (1994). Using confidence intervals in within-subject designs. *Psychonomic Bulletin & Review*, 1(4), 476-490.
|
|
706
|
+
- Luck, S. J. (2014). *An Introduction to the Event-Related Potential Technique* (2nd ed.). MIT Press.
|
|
707
|
+
- Morey, R. D. (2008). Confidence intervals from normalized data. *TQMP*, 4(2), 61-64.
|
|
708
|
+
- Okabe, M., & Ito, K. (2002). Color universal design (CUD). J*Fly*.
|
|
709
|
+
- Weissgerber, T. L., et al. (2015). Beyond bar and line graphs. *PLoS Biology*, 13(4), e1002128.
|