This repository contains the experimental paradigm and analysis code for an fMRI study investigating how the brain detects the absence of expected sensory stimuli.
Note: This paper is currently under review. Citation information will be added upon publication.
How does the brain detect what is absent? This study proposes that the detection of absence relies on a distinct form of prediction error dedicated to reducing beliefs about stimulus occurrence, termed subtractive prediction error. Using high-resolution fMRI of the human auditory system, we show that:
- Subtractive prediction error is encoded in the auditory thalamus (medial geniculate body; MGB) and primary auditory cortex (aHG)
- Unlike feature prediction error, subtractive prediction error is not encoded in the auditory midbrain (inferior colliculus; IC)
- These findings suggest that absence-related error signals emerge at the thalamic level and are supported by a distinct neural circuit
The study used an auditory omission paradigm where participants listened to sequences of pure tones with occasional omissions. Participants (N=15) attended to sequences of up to 8 repetitions of pure tones (500ms ISI) and reported the position of omissions when present. Omissions occurred at positions 4, 5, or 6 with probability 6/7. Data were acquired using high-resolution partial-coverage fMRI optimized for subcortical auditory structures.
.
├── presentation/ # Experimental paradigm (MATLAB/Psychtoolbox)
│ └── omres.m # Main experiment script
├── results/ # Preprocessed data for reproducing figures
│ ├── betas_t1w.pickle # Beta estimates from first-level GLM
│ ├── funcloc_t1w.pickle # Functional localizer contrasts
│ ├── noise_t1w.pickle # Residual variance estimates
│ └── zscores_t1w.pickle # Z-scored beta estimates
├── analysis.py # Second-level analyses and figure generation
├── nitabs3.py # Generic fMRI preprocessing and analysis library
├── omresconfig.py # Study-specific configuration
└── pipeline.py # First-level analysis pipeline
- MATLAB
- Psychophysics Toolbox
- Python 3.7+
- Required Python packages:
- numpy
- scipy
- pandas
- matplotlib
- seaborn
- nibabel
- nipype
- fMRIPrep 23.2.2+ (for preprocessing raw fMRI data)
- SPM12 (for GLM estimation)
- FreeSurfer 7.3.2+ (for cortical surface reconstruction)
If you only want to reproduce the figures and statistical tables from the preprocessed results:
python analysis.pyThis will generate all figures and supplementary tables in the figures/ directory:
fig2-omres.pdf- Adaptation and omission responses across regionsfig3-rois.pdf- Negative prediction error effectsfig4-emergence.pdf- Hierarchical emergence of prediction errorsfigS2-allregs.pdf- All regressors across ROIsfigS3-participants.pdf- Individual participant resultsfigS4-residuals.pdf- Residuals-weighted analysestabS1-omres.tex- Statistics for adaptation and omission effectstabS2-negpe.tex- Statistics for negative prediction errortabS3-emergence.tex- Statistics for hierarchical emergencetabS4-residuals.tex- Statistics for residuals-weighted analyses
To run the complete first-level analysis pipeline on raw data (requires raw fMRI data):
- Configure paths in
omresconfig.pyto point to your data directories - Run the pipeline:
python pipeline.pyThe pipeline performs:
-
Preprocessing (via fMRIPrep):
- Motion correction
- Coregistration to T1w
- Normalization to MNI space
- Confound extraction (motion, CSF, white matter)
-
ROI Definition:
- Subcortical ROIs (IC, MGB): Anatomical atlas + functional localizer
- Cortical ROIs (aHG): FreeSurfer parcellation
-
GLM Estimation (via SPM12):
- Main experiment: 6 regressors (std0, std1, std2, om4, om5, om6)
- Functional localizer: sound vs. silence contrast
- Parametric modulation for repeated standards (std1, std2)
-
Extraction:
- Beta estimates and z-scores for each condition and ROI
- Functional localizer contrasts
- Residual variance estimates
The results/ folder contains preprocessed derivatives necessary to reproduce all figures and statistics:
- Beta estimates from first-level GLM analyses
- Functional localizer contrasts
- Z-scored estimates
- Residual variance estimates
First-level GLM results (beta images, contrast images, ROIs) for all subjects are publicly available on Zenodo:
DOI: 10.5281/zenodo.17603000 URL: https://zenodo.org/records/17603000
The Zenodo repository contains the complete derivatives folder for all 15 subjects, including:
- Beta images for all conditions in T1w and MNI space
- Contrast and t-statistic images
- Residual images
- ROI masks (anatomical and functional)
- JSON metadata files
The Zenodo data contains all first-level GLM results needed to run the extraction and second-level analyses (lines 39-42 of pipeline.py).
After downloading from Zenodo, update the file paths to match your local system:
import nitabs3
# Relocate koffer to your local path
nitabs3.relocate_koffer(
'/path/in/downloaded/json', # Path embedded in downloaded JSON files
'/your/local/path/koffer', # Where you actually saved the data
mode='verify' # Update paths without moving files
)Then run the extraction steps in pipeline.py (lines 39-42) to reproduce the results/ files, followed by analysis.py to generate all figures and tables.
Raw fMRI data (structural and functional images) are not publicly available because they contain personally identifiable biometric information and we do not have permission from participants to share them.
- Participants: 15 healthy adults (10 female, age 19-34)
- Acquisition: 3T Siemens Prisma, partial-coverage EPI (24 slices, 1.5mm isotropic, TR=2100ms)
- Preprocessing: fMRIPrep 23.2.2
- GLM Estimation: SPM12, including motion, CSF, and white matter nuisance regressors
- ROI Definition:
- IC & MGB: Anatomical atlas (Sitek et al. 2019) + functional localizer
- aHG: FreeSurfer Destrieux atlas
- Statistics: Non-parametric ranksum tests, Holm-Bonferroni correction for multiple comparisons
- Adaptation: std0 > std1 (response reduction to repeated standards)
- Omission response: om4 > std1 (response to omission vs. expected sound)
- Subtractive prediction error: om4 > om6 (position 4 omission > position 6 omission)
Generic library for fMRI data analysis providing:
- Interface to fMRIPrep preprocessing
- GLM estimation via SPM12/Nipype
- ROI extraction utilities
- Beta estimate and contrast extraction
Study-specific configuration including:
- Data paths and directory structure
- ROI definitions (anatomical and functional)
- GLM design specifications for main task and localizer
- Event file parsing functions
Orchestrates the complete first-level analysis:
- Calls fMRIPrep for preprocessing
- Creates ROIs using anatomical and functional criteria
- Estimates GLMs for main task and localizer
- Extracts beta estimates, z-scores, and residual variance
Implements all second-level (group) analyses:
- Loads preprocessed results from
results/ - Statistical tests across participants and ROIs
- Generates all manuscript figures and tables
- Applies multiple comparison corrections
This work is currently under review. Citation information will be provided upon publication.
Preregistration: The study was preregistered at OSF (https://osf.io/86a4x).
For questions about the code or methods, please contact Alejandro Tabas.
Code is provided for reproducibility and research purposes. Please cite the associated paper when using this code.