Behavioral and multimodal analysis of reward learning and stress across development
This repository contains the preprocessing and analysis pipeline for a research project examining reward learning, stress responses, and developmental differences using a virtual-reality stress paradigm.
The pipeline integrates:
- probabilistic reward-learning behavior;
- heart-rate recordings;
- EEG data;
- participant and session metadata;
- developmental group information.
The project emphasizes reproducible behavioral analysis, multimodal integration, automated data validation, and privacy-conscious research-data management.
The project supports questions such as:
- How do participants learn reward contingencies across repeated trials?
- How much individual variability exists in learning?
- Do reward-learning patterns differ across experimental sessions?
- How are learning and physiological stress responses related?
- Are there developmental differences between younger and older participants?
Behavioral analyses include:
- group-average and individual learning curves;
- first-vs-second-half performance;
- session comparisons;
- learning-rate and learning-slope analyses;
- win-stay / lose-switch behavior;
- exploratory learner-group comparisons.
The pipeline parses and validates physiological files, summarizes data availability, and prepares measures for integration with behavioral data.
A reusable participant-session table combines available:
- behavioral measures;
- JATOS/session metadata;
- heart-rate summaries;
- EEG summaries;
- developmental-group information.
This provides a common dataset for behavioral, developmental, and multimodal analyses.
Puberty_VR/
├── data/
│ ├── raw/ # Local participant data — not committed
│ ├── processed/ # Processed behavioral data
│ ├── analysis_data/ # Analysis-ready datasets
│ └── metadata/ # Inventories and validation reports
│
├── scripts/
│ ├── setup/
│ ├── heart_rate/
│ ├── eeg/
│ ├── learning_rates/
│ └── multimodal/
│
├── outputs/ # Generated results and figures
├── documentation/
├── PROJECT_AUDIT.md
└── requirements.txt
Python 3.10+ is recommended.
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txtOn Windows:
.venv\Scripts\activateThe primary workflow is:
# Validate and organize source data
python3 scripts/setup/raw_data_inventory.py
python3 scripts/setup/validate_raw_data.py
# Convert pLearning data
python3 scripts/setup/process_jatos_python.py
# Generate physiological summaries
python3 scripts/heart_rate/summarize_heart_rate.py
python3 scripts/eeg/summarize_eeg.py
# Behavioral learning analysis
python3 scripts/learning_rates/calculate_learning_rates.py
# Build integrated participant-session dataset
python3 scripts/multimodal/build_multimodal_dataset.pyAdditional behavioral and statistical analyses are available under scripts/learning_rates/ and scripts/multimodal/.
- Learner groups currently use an exploratory Session 1 median split of an estimated learning parameter.
- Continuous developmental comparisons use Welch tests with Hedges' g.
- Binary comparisons use Fisher's exact tests.
- Valid p-values receive Benjamini-Hochberg FDR correction.
- Small developmental subgroups limit statistical power and should be interpreted cautiously.
Participant-level research data are excluded from Git.
Do not commit:
- participant names or direct identifiers;
- consent forms;
- raw physiological recordings;
- protected subject-level datasets.
Detailed code and data-quality review notes are available in PROJECT_AUDIT.md.
- Not every participant has every physiological modality.
- Physiological data quality and availability vary across participants.
- Developmental subgroup sizes may be small.
- Several analyses are exploratory rather than confirmatory.
Skills: Python · pandas · SciPy · Behavioral Modeling · Statistical Analysis · EEG · Heart Rate · Multimodal Data · Research Data Management
Subject-level files can be standardized before processing:
python3 scripts/setup/standardize_file_names.pyThis performs a dry run and writes proposed changes to:
data/metadata/rename_log.csv
After reviewing potential conflicts such as target_exists, duplicate_target_in_plan, and subject_mismatch, changes can be applied with:
python3 scripts/setup/standardize_file_names.py --applyCanonical subject folders use:
sub###
Processed pLearning files use:
###_plearning_1.csv
###_plearning_2.csv
Restricting accepted filenames prevents stale or improperly named files from being treated as participants.
python3 scripts/setup/raw_data_inventory.py
python3 scripts/setup/validate_raw_data.pyImportant outputs include:
subject_level_inventory.csvmissing_raw_data_files.csvunrecognized_raw_files.csvraw_data_quality_issues.csv
These checks identify missing files, schema mismatches, duplicate content, and naming conflicts before analysis.
python3 scripts/setup/process_jatos_python.pyThe script recursively searches data/raw/subject_data/, converts JATOS pLearning exports into standardized trial-level CSV files, and updates participant/session metadata.
calculate_learning_rates.py should be run before analyses that depend on learner-group classifications.
Additional scripts support:
- individual learning curves;
- group-average curves;
- first-vs-second-half analyses;
- learning-rate analyses;
- learning-slope analyses;
- summary statistics;
- win-stay / lose-switch analyses.
python3 scripts/multimodal/build_multimodal_dataset.pyThe main output is:
data/analysis_data/multimodal/
└── multimodal_subject_session_summary.csv
The dataset contains one row per participant × pLearning session. Session-specific metadata are joined by both participant and session, while participant-level physiological summaries can be associated with the relevant participant rows.
python3 scripts/multimodal/compare_minors_to_older.py
python3 scripts/multimodal/summarize_minor_comparison.pyRepeated participant-level measures are tested once per person, while session-varying variables are compared separately by session.
learning_slope_analysis.py currently uses a Gaussian linear mixed model for a binary trial-level outcome. This can be useful descriptively, but a binomial mixed-effects model or GEE would be preferable for confirmatory inference.