IDMIM is a MATLAB pipeline for analysing rodent operant decision-making data using computational models. This framework implements hierarchical Gaussian filter (HGF) models and Rescorla-Wagner reinforcement learning models to characterise learning and volatility parameters from behavioural choice data.
- Extraction and processing of experimental data from MED-PC files
- Fitting of multiple computational models:
- 3-level Hierarchical Gaussian Filter (HGF)
- 2-level Hierarchical Gaussian Filter
- Rescorla-Wagner (RW) model
- Model comparison using Bayesian Model Selection
- Parameter recovery analysis for model validation
- Automated creation of analysis tables for statistical testing
- Comprehensive visualisation of model fits and parameters
- MATLAB R2019b or newer
- TAPAS Toolbox (for HGF models)
- SPM12 Toolbox (for Bayesian Model Selection)
- Input data from MedAssociates MED-PC in text format
- Clone or download this repository
- Add the repository and its subfolders to your MATLAB path
- Download and install the required toolboxes:
- TAPAS Toolbox
- SPM12
- Create the data folder structure:
/path/to/data/ ├── raw/ │ ├── 2023_UCMS/ │ ├── 2024_HGFPilot/ │ └── 5HT/ ├── 2023_UCMS/ ├── 2024_HGFPilot/ └── 5HT/
- Place your MED-PC text files in the appropriate raw/[cohort_name]/ folder
- Rename the cohort folders according to your experimental cohorts
- Set Data Paths:
- Open runOptions.m
- Set
optionsFile.paths.saveDir
to your data directory path
- Configure Cohort Details:
- Edit setDatasetSpecifics.m to specify:
- Mouse IDs and group assignments (treatment/control)
- Task names and parameters
- Conditions and task repetitions
- Exclusion criteria
- Edit setDatasetSpecifics.m to specify:
- Select Analysis Steps:
-
In
runOptions.m
, enable/disable steps by setting to 1 (run) or 0 (skip):optionsFile.doOptions = 1; % Generate option file optionsFile.doGetData = 1; % Extract data from MED-PC files optionsFile.doSimulations = 1; % Run model simulations optionsFile.doModelInversion = 1; % Fit models to data optionsFile.doBMS = 1; % Perform Bayesian Model Selection
- Generate Options File:
- Run
runOptions
in MATLAB to create optionsFile.mat
- Run
Run the complete analysis pipeline for a specific cohort:
runAnalysis(cohortNo) % Where cohortNo is the cohort index (e.g., 1, 2, or 3)
You can also run specific components separately:
% Extract data from MED-PC files
getData(cohortNo);
% Fit models to behavioural data
fitModels(cohortNo);
% Parameter recovery analysis
parameterRecovery(cohortNo, subCohort, iTask, iCondition, iRep, nReps);
% Bayesian Model Selection
performBMS(cohortNo, subCohort, iTask, iCondition, iRep);
% Generate analysis tables for specific hypotheses
createHypothesis1_2_Table(); % Treatment vs. control learning parameters
createHypothesis2_2_Table(); % Learning parameter changes across repetitions
createHypothesis3_2_Table(); % Dru
767C
g treatment effects on volatility parameters
The pipeline produces several types of output files:
- Processed data files (
.mat
): Contains trial-by-trial behavioral data - Model fit results (
.mat
): Individual model parameters for each mouse - Analysis tables (
.csv
): Summary tables for statistical analysis - Diagnostic plots (
.png
/.fig
): Parameter recovery, model comparison, and trajectory plots
- File not found errors: Verify your path structure matches what's specified in
optionsFile
- Model fitting errors: Check your data format and ensure all required columns are present
- Memory issues: For large datasets, consider processing cohorts individually
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
If you use this pipeline in your research, please cite: [Citation information to be added upon publication]