P300 offline analysis

Forum for discussion on different signal processing algorithms
Locked
scwang
Posts: 5
Joined: 21 Jun 2012, 11:37

P300 offline analysis

Post by scwang » 14 Oct 2013, 18:11

Hi everyone,

I work with p300 data recorded by previous research groups in the lab. The data was saved with BCI2000 P3speller tasks as dat format. All the event markers were present. Right now I would like to perform ICA on one or two selected channels to isolate useful P300 response from EMG and EOG artifacts, but I still have yet to figure out where the P300 response occurred in each waveform. Is there any way for me to analyze p300 data like this in the time domain?

Thank you

scwang

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: P300 offline analysis

Post by boulay » 15 Oct 2013, 00:01

Dear scwang,

You say you want to do ICA so I recommend you use EEGLAB. It is a Matlab toolbox for analyzing EEG data with an emphasis on ICA. EEGLAB has a plugin to import BCI2000 dat files. http://www.bci2000.org/wiki/index.php/U ... GLabImport(The version of the plugin included with EEGLAB is a little old but it works. You can get the newer version from the BCI2000 svn)

When you import your BCI2000 dat files you will have to select the states you want to import. These states will be converted to EEGLAB "events". According to http://www.bci2000.org/wiki/index.php/U ... ask#States, I think you want StimulusBegin.

Unfortunately, EEGLAB's concept of "events" does not map well to BCI2000 states, so you have to do some more state->event wrangling manually. In Matlab, use load_bcidat to load the datafiles including their states. Find where states.StimulusBegin changes from 0->1. At those indices, find the value of states.StimulusType. Then, in the EEGLAB data structure (usually named 'EEG'), add a 'StimulusType' field of your 'StimulusBegin' events and set the values of those fields to the same as the values identified from states.StimulusType. Now your EEG struct has an event at each occurrence of a stimulus flash and each event has a field StimulusType valued 1 for target (i.e., P300) or 0 for non-target.

Then do your preprocessing:
Remove bad channels.
Filter.
Common-average referencing.
Down-sampling.
Epoch around StimulusBegin events (something like -100 ms to +1000 ms).
Subtract baseline from each epoch.
(Optional) Remove bad epochs.
ICA (using all good channels).

Now you can subtract your artifactual components and look at the ERPs in the channel space, comparing epochs with StimulusType==0 (Non-Target) to epochs with StimulusType==1 (Target). Alternatively, you can do a Target-NonTarget comparison on ERPs from component activities, especially those that project to medial parietal cortex.

I left out a lot of details and some Matlab code necessary to do all of the above steps. I think there's already a lot of information here on how to get started but if you choose to go this way and you get stuck then you can ask here and I will try to help.

-Chad

scwang
Posts: 5
Joined: 21 Jun 2012, 11:37

Re: P300 offline analysis

Post by scwang » 15 Oct 2013, 18:01

Hi, Chad
boulay wrote: When you import your BCI2000 dat files you will have to select the states you want to import.
Thank you for the recommendation. Do I need to convert BCI2000 data to ascii file first, since EEGLAB does not seem to support importing dat files directly?
boulay wrote: Then, in the EEGLAB data structure (usually named 'EEG'), add a 'StimulusType' field of your 'StimulusBegin' events and set the values of those fields to the same as the values identified from states.StimulusType. Now your EEG struct has an event at each occurrence of a stimulus flash and each event has a field StimulusType valued 1 for target (i.e., P300) or 0 for non-target.
Please correct me if I'm wrong. 'StimulusBegin' is 1 whenever a flash occurs on the screen, and 'StimulusType' is 1 when the subject is focusing on a particular letter when the flash occurs. In other words, a P300 response should be triggered every time 'StimulusType' transit from 0 to 1.

Thank you

scwang

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: P300 offline analysis

Post by boulay » 15 Oct 2013, 23:18

scwang wrote: Thank you for the recommendation. Do I need to convert BCI2000 data to ascii file first, since EEGLAB does not seem to support importing dat files directly?
No, you can import the BCI2000 dat file directly. In the EEGLAB GUI, click on File->Import Data->Using EEGLAB functions and plugins->From BCI2000 DAT file. Or, from the command line, use pop_loadBCI2000. The instructions may be found by following the first link in my previous post.
scwang wrote: Please correct me if I'm wrong. 'StimulusBegin' is 1 whenever a flash occurs on the screen, and 'StimulusType' is 1 when the subject is focusing on a particular letter when the flash occurs. In other words, a P300 response should be triggered every time 'StimulusType' transit from 0 to 1.
I haven't used the P3Speller task in a long time so I can only go by the information in the WIKI (linked in my previous post). Your interpretation seems correct. Note that this only works when using "Copy Spelling" mode because otherwise the intended target is not known.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests