R Programming for Brain-Computer Interface Data Analysis Library Functions – UROP Spring Symposium 2025

R Programming for Brain-Computer Interface Data Analysis Library Functions

Yixin Yuan

Research Mentor(s): Jane Huggins
Mentor Department: Physical Medicine and Rehabilitation
Authors: Yixin Yuan, Jane Huggins
Session: Session 3 (11:00am – 11:50am)
Presentation Type: Poster 50

Abstract

Brain-computer interfaces (BCIs) offer communication and control options for individuals with severe physical impairments (Farwell & Donchin, 1988). Among the various approaches, non-invasive P300-based BCIs are especially common for applications. However, EEG data analysis is often complicated and spread across multiple software environments. To address this challenge, the University of Michigan Direct Brain Interface (UM-DBI) Laboratory, which emphasizes clinically relevant BCI research, has undertaken a project to streamline data analysis using the R programming language. This project focuses on developing a set of R-based library functions that can (1) load and parse EEG recordings with event markers from .mat files, (2) segment data based on trial boundaries, (3) extract crucial timing and stimulus information, (4) differentiate target and non-target responses, and (5) compute classification scores for P300-based paradigms. I also implemented visualization functions to facilitate quick quality checks of trial labels and state variables. Throughout the development process, I iteratively tested each function against MATLAB-based outputs used in the UM-DBI Lab to ensure accuracy and compatibility. Preliminary testing indicates that these R modules reduce manual coding effort and maintain consistency with existing MATLAB-based pipelines within the UM-DBI Lab. Visual inspections, aided by plotting functions, confirm correct labeling and segmentation, reducing the likelihood of trial misalignment. By promoting a reproducible workflow and consolidating key analysis steps into a single language, this approach lowers the barrier to entry for both new and experienced researchers. Future plans include extending support to additional BCI tasks and incorporating more advanced signal-processing features.

lsa logoum logo