310 likes | 457 Vues
RIDE implementation/manual. Speaker:. Guang Ouyang Department of Physics Hong Kong Baptist University. Preparations Start RIDEing After RIDEing Hints and Cautions on RIDE Useful Plottings Principles for Publications. Preparations Requirements: Matlab 2008 or later
E N D
RIDE implementation/manual Speaker: GuangOuyang Department of Physics Hong Kong Baptist University
Preparations • Start RIDEing • After RIDEing • Hints and Cautions on RIDE • Useful Plottings • Principles for Publications
Preparations • Requirements: • Matlab 2008 or later • Memory > 1G • Set path: • Add the folder RIDE_call to the paths of Matlab
Preparations • Export data from commercial ERP softwares: • Export the EEG data from the commercial softwares (e.g., BrainVision, NeuroScan, etc.) separately for EACH subject and EACH condition after strict ARTIFACT rejection; • Failure/improper of artifact rejection could possibly lead to unexpected results after application of RIDE. Examples of improper artifact rejection
Preparations • Export the data into segmented form, (e.g., from -200 ms to 1200ms after stimulus onset). trials channels epoch (e.g., from -200ms to 1200ms)
Preparations • Load data into Matlab: • One can use EEGLAB to load the data exported from commercial softwares into Matlab (e.g., file -> import data -> using EEGLAB functions and plugins -> From Neuroscan .eeg file). Note: EEGLAB may evolve with different interfaces in different versions. But one can always easily figure out how to import data exported by various commercial software to Matlab (download from http://sccn.ucsd.edu/eeglab/). • Once it is loaded, the data is saved in the structure variable ‘EEG’ • The reaction times can be also extracted in this way (if it is available)
Preparations • Load data into Matlab: • For RIDE, the data should be prepared in 3 dimension of which the first dimension is the epoch, the second is the channels (electrodes), the third is the trials. If the data from EEGLAB is not in this order, use the Matlab function ‘permute’. • When loading the data, discard the ‘non-brain’ electrodes, e.g., M1,M2,VEOU,VEOL,EOG, ECGetc. • For testing RIDE, one can load the example data from RIDE_call\example\samp_face.mat • In this data, there are 65 channels and 173 trials, the epoch is with 550 dots ranging from -100 ms to 1000 ms. The sampling rate is 500 (sampling interval is 2 ms).
Start RIDEing • Create a new m-script and type the following: cfg = [];%initialization cfg.samp_interval = 2; cfg.epoch_twd = [-200,1200]; cfg.comp.name = {'s','c','r'}; cfg.comp.twd = {[0,600],[100,900],[-300,300]}; cfg.comp.latency = {zeros(size(data,3),1),'unknown',rt}; cfg = RIDE_cfg(cfg); results = RIDE_call(data,cfg);
Start RIDEing • Create an new m-script and type the following: single value – the time between each two consecutive dots of the data, in the unit of millisecond. For examples, if 2ms (500 sampling rate), set it as 2; if cfg = [];%initialization cfg.samp_interval = 2; cfg.epoch_twd = [-100,1000]; cfg.comp.name = {'s','c','r'}; cfg.comp.twd = {[0,600],[100,900],[-300,300]}; cfg.comp.latency = {zeros(size(data,3),1),'unknown',rt}; cfg = RIDE_cfg(cfg); results = RIDE_call(data,cfg); time window of you data epoch (the first dimension of your data), in the unit of millisecond). Involve enough epoch covering the ERP, but don’t involve too much irrelevant segments (details refer to the handbook). twd(1) must ≤ 0. This is just simply the component names. Once can extend the application of RIDE to different cases, e.g., 1) only S and C; 2) only S and R; 3) more then one C
Start RIDEing • Create an new m-script and type the following: The time window that likely covers each of the RIDE components. More detail refer to the handbook. The time window for R is relative to the reaction time. cfg = [];%initialization cfg.samp_interval = 2; cfg.epoch_twd = [-100,1000]; cfg.comp.name = {'s','c','r'}; cfg.comp.twd = {[0,600],[100,900],[-300,300]}; cfg.comp.latency = {zeros(size(data,3),1),'unknown',rt}; cfg = RIDE_cfg(cfg); results = RIDE_call(data,cfg); The latency information for the component one wants to separate. In the example, the latency of S component is all-zero vector (with a length of trial number) and the latency of R component is the vector of reaction times. The latency of C component should be set to be ‘unknown’ as it is to be estimated. For the data without RT, just omit the third cell. Running RIDE
Start RIDEing • When RIDE was being run, there will be some information output to the command window showing the progress of the processing, e.g, how much iteration step for each channel by the RIDE definition of convergence. • Normally it takes less than 5mins to process data for 1 subject (single condition) with 60 channels and 100 trials Estimated: 5 mins
After RIDEing • Know how to see the results Please refer to the handbook for detailed explanation for all of the meanings of the variables in the outcome
After RIDEing • Advanced uses • Want to know more advanced uses about RIDE? The usage of RIDE in the last slides are just the basic use. Those parameters are compulsory. Some other parameters are optional, and the meanings of them are fully listed in the handbook. One may use the optional parameters for specific cases.
Phraseology of RIDE components For a single subject mean RT mean RT Single trial ERP Single trial S Single trial C Single trial R Single trial C Single trial R trial #1 trial #2 trial #3 trial #4 trial #5 trial #6 trial #7 trial #8 trial #9 trial #10 . . . 0ms 1000ms 0ms 1000ms 0ms 1000ms 0ms 1000ms 0ms 1000ms 0ms 1000ms ERP Stimulus-locked averaged • R • Mean RT-locked averaged • R_sl • Stimulus-locked averaged • C • Mean latency-locked averaged • C_sl • Stimulus-locked averaged • S • Stimulus-locked averaged
Difference between latency-locked and stimulus-locked RIDE components Single trial C Single trial C Single trial C trial #1 Sync to the median latency (most probable latency) trial #2 trial #3 average trial #4 trial #5 trial #6 trial #7 trial #8 trial #9 trial #10 . . . 0ms 1000ms 0ms 1000ms 0ms 1000ms blurred restored • C_sl • Stimulus-locked averaged • C • latency-locked averaged
Difference between latency-locked and stimulus-locked RIDE components • Same principle applies to R component; the latency of R component is just simply reaction times. • For S component, the stimulus-locked pattern is the same with latency-locked pattern, because the latency of S is stimulus onsets. • The latency-locked RIDE component is the most probable representation across single trials because it is synchronized to the median latency.
Deal with cross-subject variability, esp. in R component trial #1 trial #2 trial #3 subject #1 trial #4 trial #5 . . . . . . mean RT for sub #1 mean RT for sub #2 0ms 1000ms trial #1 0ms 1000ms mean RT for sub #3 trial #2 trial #3 subject #2 trial #4 0ms 1000ms trial #5 . . . . . . 0ms 1000ms 0ms 1000ms trial #1 trial #2 trial #3 Grand average: again smeared subject #3 trial #4 trial #5 . . . . . . Locked to median of mean RTs: restored 0ms 1000ms
Stimulus Re-constructed ERP Trial 1 0ms 0ms 0ms 0ms 0ms 1800ms 1800ms 1800ms 1800ms 1800ms Trial 2 Trial 3 Trial i . . . Average ERP
Re-constructed ERP Stimulus Trial 1 0ms 1800ms Trial 2 0ms 1800ms Trial 3 0ms 1800ms Trial i 0ms 1800ms . . . Average ERP 0ms 1800ms
After RIDEing • What to see? • One can have a look at the time courses, topographies (using EEGLAB function, topoplot) , the latency variability of C component etc. • Statistical testing. After applying RIDE on all the subjects and conditions. One can do any statistical testing on the re-constructed ERP, just like what you did on the conventional ERP. The size, dimensions of the re-constructed ERP is totally the same with the conventional ERP. • Additionally, one can also do the statistical testing on each RIDE components. • Admirably, one can again import all of the RIDE data, esp. the reconstructed ERP into commercial ERP software (like BESA) to run all of the analysis on the reconstructed ERP in exactly the same way as does the conventional ERP.
After RIDEing • What to see? • Example 1: show the ERP the RIDE components for this subject: chan_index = find(strcmp({chanlocs.labels},'Pz')); t = linspace(cfg.epoch_twd(1),cfg.epoch_twd(2),size(data,1)); figure;plot(t,results.erp(:,chan_index),'k'); hold on;plot(t,results.s(:,chan_index),'b'); hold on;plot(t,results.c(:,chan_index),'r'); hold on;plot(t,results.r(:,chan_index),'g'); axis([t(1),t(end),-5,25]); legend({'erp','s','c','r'});
After RIDEing • What to see? • Example 2: show the ERP the re-constructed ERP: chan_index = find(strcmp({chanlocs.labels},'Pz')); t = linspace(cfg.epoch_twd(1),cfg.epoch_twd(2),size(data,1)); figure;plot(t,results.erp(:,chan_index),'k'); hold on;plot(t,results.erp_new(:,chan_index),'b'); axis([t(1),t(end),-5,25]); legend({'erp','reconstructed ERP'}); 5 μV is a relatively big difference
After RIDEing • What to see? • Example 3: show the topographies (needs EEGLAB) t = 500;t1 = fix((t-cfg.epoch_twd(1))/cfg.samp_interval); figure;subplot(1,4,1);topoplot(results.erp(t1,:),chanlocs);text(0,1,'erp'); subplot(1,4,2);topoplot(results.s(t1,:),chanlocs);text(0,1,'s'); subplot(1,4,3);topoplot(results.c(t1,:),chanlocs);text(0,1,'c'); subplot(1,4,4);topoplot(results.r(t1,:),chanlocs);text(0,1,'r');
After RIDEing • What to see? • Example 4: statistical testing • The present example is only for one single subject. You can accordingly apply RIDE on every single subject of your data for difference conditions then test the effects on, for example, re-constructed ERP and compare with conventional ERP. • There is an example RIDE outcome for subjects from a face recognition experiment with two different conditions – primed familiar and un-primed familiar. Once can do simple t-testing like this: samp_interval = 2;twd = [-100,1000]; t = linspace(twd(1),twd(2),550); chan_index = find(strcmp('Pz',{chanlocs.labels})); c = [-6,20];w=100; twd0 = [351,550];twd1=twd0; twd1 = fix((twd1-twd(1))/samp_interval);twd1 = twd1(1):twd1(2); figure;subplot(1,2,1); plot(t,mean(erp_pu(:,chan_index,:),3),'k'); axis([t(1),t(end),c(1),c(end)]); hold on;imagesc(linspace(twd0(1),twd0(2),w),linspace(c(1),c(2),w),zeros(w,w));alpha(0.4); hold on;plot(t,mean(erp_uu(:,chan_index,:),3),'r');title('original ERP'); [p1,p2,p3,p4] = ttest(mean(erp_pu(twd1,chan_index,:)),mean(erp_uu(twd1,chan_index,:))); text(100,-2,{['t=',num2str(p4.tstat)];['p=',num2str(p2)]}); subplot(1,2,2);plot(t,mean(erp_new_pu(:,chan_index,:),3),'k');axis([t(1),t(end),c(1),c(end)]); hold on;plot(t,mean(erp_new_uu(:,chan_index,:),3),'r');title('reconstructed ERP'); hold on;imagesc(linspace(twd0(1),twd0(2),w),linspace(c(1),c(2),w),zeros(w,w));alpha(0.4); [p1,p2,p3,p4] = ttest(mean(erp_new_pu(twd1,chan_index,:)),mean(erp_new_uu(twd1,chan_index,:))); text(100,-2,{['t=',num2str(p4.tstat)];['p=',num2str(p2)]}); legend({'primed','unprimed'});
After RIDEing • What to see? • Or course, if not used to Matlab environment, one can try to import the outcome of RIDE into commercial software (we are developing this approach). Any collaboration for this work is very much welcome!
Hints and Cautions • Data quality • The general quality of data is important for the quality of outcome. Be careful of the quality of your data. Better to have a visual inspection of your data before applying RIDE. Examples of bad data
Hints and Cautions • Signal to noise ratio • The general quality of data is important for the quality of outcome. Be careful of the quality of your data. Better to have a visual inspection of your data before applying RIDE. Examples of low and high STN ratio
Hints and Cautions • Properly specifying the time window for extracting RIDE components • Have a appropriate assumption about on which time window the RIDE component is contained is important for deriving significant components. More principles please refer to the handbook. • Sufficient ISI (inter-stimuli interval) • In some ERP experiment (e.g., reading), the interval between each adjacent stimulus is too short (e.g., 600ms), therefore, the ERP for the next stimulus is overlapping with the late part of the ERP for the present trial. This kind of entanglement is again not good for RIDE because the mixture affects the latency estimation of C. • Trial number • In principle, the trial number for RIDE should be equal or larger than the component number to be adequate for separation. However, it is preferred that the trial number should be large in order to overcome the imprecision of the result due to the single trial noise. In general, a little bit more than 50 trials (for each subject and each condition) is about the minimum standard to have to proper outcome (empirical suggestion). • More hints please refer to handbook
Principles for publications • If you have something to publish.. • Good! Just remember that manuscripts related to RIDE application should simply involve all of the input parameters and the version of RIDE used. cfg = [];%initialization cfg.samp_interval = 2; cfg.epoch_twd = [-100,1000]; cfg.comp.name = {'s','c','r'}; cfg.comp.twd = {[0,600],[100,900],[-300,300]}; cfg.comp.latency = {zeros(size(data,3),1),'unknown',rt}; cfg = RIDE_cfg(cfg); results = RIDE_call(data,cfg);
Contacts • Please refer to http://cns.hkbu.edu.hk/RIDE.htm For more information such as toolbox, handbook, slides, papers. And for all of the updates. • For technical problems, you may consult Guang Ouyang: guang.ouyang@gmail.com