This repository contains the core implementation of the Bayesian Phase-Amplitude Coupling (PAC) model presented in our manuscript on EEG-based analysis of reading difficulties in children. The approach uses probabilistic modeling to estimate directional connectivity between EEG channels while accounting for uncertainty in both data and inference.
The method has been developed and tested using EEG data collected under controlled auditory stimulation at 4.8, 16, and 40β―Hz, with the aim of identifying functional coupling differences between typically developing children and those with reading difficulties.
If you use this method, please, cite our paper:
Diego Castillo-Barnes, AndrΓ©s Ortiz, Patricia Figueiredo, NicolΓ‘s J. Gallego-Molina.:"A Bayesian Framework for Phase-Amplitude Cross-Frequency Coupling Inference: Application to Reading Disability Detection". Expert Systems with Applications, 2025. https://doi.org/10.1016/j.eswa.2025.128510
This notebook performs the full analysis pipeline for a single subject:
- Loads PAC values and time fragments.
- Computes conditional probabilities using non-parametric Kernel Density Estimation (KDE).
- Applies Bayesian inference to estimate directed PAC connections.
- Outputs a subject-level probability matrix for directional connectivity.
This notebook takes individual probability matrices (from multiple subjects) and:
- Compares connectivity patterns between two groups (e.g., controls vs. dyslexia).
- Performs statistical testing (e.g., z-scores, permutation tests).
- Outputs group-level summary figures and statistical results.
We chose Jupyter Notebooks to ensure transparency, reproducibility, and accessibility. This format allows users to:
- Read and execute the analysis step-by-step.
- Modify parameters interactively.
- Visualize results directly within the workflow.
Researchers can adapt the pipeline to their own EEG datasets by editing and running the notebooks in any standard Python environment.
-
Clone or download the repository:
git clone https://github.com/BioSIP/BayesianPAC.git
-
Create a Python environment with the following recommended packages:
numpyscipypandasmatplotlibseabornscikit-learnstatsmodelsjupyter
-
Launch Jupyter:
jupyter notebook
-
Open and run one of the following notebooks:
BPAC_OneSubject.ipynb: to compute subject-level PAC connectivity.BPAC_GroupsComparison.ipynb: to perform statistical comparisons between two groups.
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
You are free to:
- Share β copy and redistribute the material in any medium or format.
- Adapt β remix, transform, and build upon the material.
Under the following terms:
- Attribution β You must give appropriate credit.
- NonCommercial β You may not use the material for commercial purposes.
For full details, see the license description here:
https://creativecommons.org/licenses/by-nc/4.0/
This repository is maintained by the BioSIP research group, University of MΓ‘laga.
If you have questions, comments, or would like to collaborate, please contact us at:
π§ www.biosip.uma.es