Diff for "LinearRegression" - Meg Wiki
location: Diff for "LinearRegression"
Differences between revisions 7 and 32 (spanning 25 versions)
Revision 7 as of 2009-02-12 10:31:39
Size: 3174
Editor: YaaraErez
Comment:
Revision 32 as of 2009-04-03 16:46:48
Size: 5816
Editor: YaaraErez
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
These tools apply multiple linear regression to EEG and MEG data, in contrast to conventional factorial averaging. The input are Neuroscan cnt-files (EEG) or Neuromag fiff-files (MEG), respectively. The output are either ascii, avg (EEG) or fiff-files (MEG), which can be processes just as conventional ERP/ERFs, e.g. with respect to source analysis. These tools are still under development. If you would like more information, please contact olaf.hauk@mrc-cbu.cam.ac.uk . A different approach to regression analysis is also part of SPM5. These tools apply multiple linear regression to EEG and MEG data, in contrast to conventional factorial averaging. In short, they provide as output the solution '''b''' of the linear equation '''y'''='''Xb''', where y are the data, '''X''' the "design matrix" including the predictor variables for all items (e.g. word length, familiarity, etc.), and '''b''' contains one regression coefficient per predictor variable.
Line 5: Line 5:
In order to run your analysis, you will end up with a script like the following: The input can be Neuroscan cnt-files (EEG) or Neuromag fiff-files (MEG), respectively. The output are either ascii, avg (EEG) or fiff-files (MEG), which can be processes just as conventional ERP/ERFs, e.g. with respect to source analysis or statistics. These tools are still under development. If you would like more information, please contact olaf.hauk@mrc-cbu.cam.ac.uk . A different approach to regression analysis is also part of SPM5.
Line 7: Line 7:
% The parameters following ### are defined once for all input files: In order to run your analysis, you should use a text editor (e.g. Textpad, Wordpad etc.) to create a script like the following (why not call it "regress_it.cof" for now):
Line 9: Line 9:
### #correl_type combine % use multiple linear regression
+ #param_file /whateverthepath/param_file.txt % file that defines predictor variables for each trigger value
----------
 . % The parameters following ### are defined once for all input files:
'''### #correl_type combine'''
Line 12: Line 13:
+ #correl_columns 3 4 5 6 7 8 % specifies which columns in param_file contain the predictor variables '''+ #param_file /whateverthepath/param_file.txt''' % file that defines predictor variables for each trigger value
Line 14: Line 15:
+ #trigger_columns 2                % specifies which column in param_file.txt contains trigger value (can be more than 1 column) '''+ #correl_columns 3 4 5 6 7 8 '''% specifies which columns in param_file contain the predictor variables
Line 16: Line 17:
+ #info_file /whateverthepath/info_file.txt % output file for number of valid trials per input file '''+ #trigger_columns 2 '''% specifies which column in param_file.txt contains trigger value (can be more than 1 column)
Line 18: Line 19:
+ #mag_thresholds 2500 0 1500 0 % tresholds for artefact rejection, magnetometers (fT) '''+ #info_file /whateverthepath/info_file.txt '''% output file for number of valid trials per input file
Line 20: Line 21:
+ #grad_thresholds 1000 0 800 0    % tresholds for artefact rejection, gradiometers (fT/cm) '''+ #mag_thresholds 2500 0 1500 0''' % tresholds for artefact rejection, magnetometers (fT)
Line 22: Line 23:
+ #eog_channels 307 308             % channel number of EOG channels '''+ #grad_thresholds 1000 0 800 0''' % tresholds for artefact rejection, gradiometers (fT/cm)
Line 24: Line 25:
+ #thresholds 150 0 100 0 % tresholds for artefact rejection, EOG (uV) '''+ #eog_channels 307 308''' % channel number of EOG channels
Line 26: Line 27:
+ #baseline -100 0              % interval for baseline correction with respect to trigger onset '''+ #thresholds 150 0 100 0''' % tresholds for artefact rejection, EOG (uV)
Line 28: Line 29:
+ #epoch_length 500 % length of epoch to be analysed '''+ #baseline -100 0     '''% interval for baseline correction with respect to trigger onset
Line 30: Line 31:
+ #pre_stim_time -100 % start latency of epoch (can be different from baseline) '''+ #epoch_length 500''' % length of epoch to be analysed

'''
+ #pre_stim_time -100''' % start latency of epoch (can be different from baseline)

%
Line 34: Line 39:
#fif /whateverthepath/MEG_infile.fif % input fiff-file
+ #outfif /whateverthepath/MEG_outfile.fif % base for output fiff-file (there will be different files for different regressors)
+ #fiff_template /whateverthepath/MEG_template.fif % will be used for head coordinates
'''#fif /whateverthepath/MEG_infile.fif''' % input fiff-file
Line 38: Line 41:
'''+ #outfif /whateverthepath/MEG_outfile.fif''' % base for output fiff-file (there will be different files for different regressors)
Line 39: Line 43:
#fif /whateverthepath/MEG_infile2.fif % input fiff-file
+ #outfif /whateverthepath/MEG_outfile2.fif % base for output fiff-file (there will be different files for different regressors)
+ #fiff_template /whateverthepath/MEG_template2.fif % will be used for head coordinates
'''+ #fiff_template /whateverthepath/MEG_template.fif''' % if specified, sensor information from this file will be used for output
Line 43: Line 45:
--------------------------------------------------------
You can also run regression analysis across multiple files, e.g. several blocks for the same subject. You can also provide an external list of trigger values.
%

% Add more files in the same way:

'''#fif /whateverthepath/MEG_infile2.fif''' % input fiff-file

'''+ #outfif /whateverthepath/MEG_outfile2.fif''' % base for output fiff-file (there will be different files for different regressors)

'''+ #fiff_template /whateverthepath/MEG_template2.fif''' % if specified, sensor information from this file will be used for output

%

% If you want to assign new values to the triggers in the fiff-file, add "#event_list":

'''#fif /whateverthepath/MEG_infile3.fif''' % input fiff-file

'''+ #outfif /whateverthepath/MEG_outfile3.fif''' % base for output fiff-file (there will be different files for different regressors)

'''+ #fiff_template /whateverthepath/MEG_template3.fif''' % will be used for head coordinates

'''+ #event_list /whateverthepath/events3.txt 1''' % The "1" indicates the column(s) in events3.txt that contain(s) the new trigger values. The file must contain as many values as there are triggers in the fiff-file. It will only produce a warning if this is not the case (see the log-file info_file.info_log), so be aware!

----------
Note that anything following a "%" will be ignored (e.g. comments), anything following "#" is a command, and "+" signifies that this command still belongs to the same file. Once you are happy with your script and you have mentally prepared for it, run the script using'''
EEG_correlation('regress_it.cof')'''in the Matlab command window.

It probably won't work, most likely because you've forgotten to add the following paths in the Matlab command window:

'''addpath /imaging/olaf/MEG/cam_tools /imaging/olaf/MEG/cam_tools/MEG /imaging/olaf/MEG/analysis'''

(a mistake easy to do, because I haven't told you to add them yet).

(and yes, sorry, it's not on Subversion yet)

----------
 . So far, these programs have been applied to EEG data in visual word recognition experiments:
 * Hauk, O., Davis, M. H., Ford, M., Pulvermüller, F., & Marslen-Wilson, W. D. (2006). The time course of visual word recognition as revealed by linear regression analysis of ERP data. Neuroimage, 30(4), 1383-1400.
 * Hauk, O., Pulvermüller, F., Ford, M., Marslen-Wilson, W. D., & Davis, M. H. (2008). Can I have a quick word? Early electrophysiological manifestations of psycholinguistic processes revealed by event-related regression analysis of the EEG. Biol Psychol.
More on linear regression can be found in standard text books, such as:

 * Montgomery, D. C., Peck, E. A., & Vining, G. G. (2006). ''Introduction to Linear Regression Analysis''. Hoboken, New Jersey: Wiley.

Multiple regression analysis applied to EEG and MEG data

These tools apply multiple linear regression to EEG and MEG data, in contrast to conventional factorial averaging. In short, they provide as output the solution b of the linear equation y=Xb, where y are the data, X the "design matrix" including the predictor variables for all items (e.g. word length, familiarity, etc.), and b contains one regression coefficient per predictor variable.

The input can be Neuroscan cnt-files (EEG) or Neuromag fiff-files (MEG), respectively. The output are either ascii, avg (EEG) or fiff-files (MEG), which can be processes just as conventional ERP/ERFs, e.g. with respect to source analysis or statistics. These tools are still under development. If you would like more information, please contact olaf.hauk@mrc-cbu.cam.ac.uk . A different approach to regression analysis is also part of SPM5.

In order to run your analysis, you should use a text editor (e.g. Textpad, Wordpad etc.) to create a script like the following (why not call it "regress_it.cof" for now):


  • % The parameters following ### are defined once for all input files:

### #correl_type combine

+ #param_file /whateverthepath/param_file.txt % file that defines predictor variables for each trigger value

+ #correl_columns 3 4 5 6 7 8 % specifies which columns in param_file contain the predictor variables

+ #trigger_columns 2 % specifies which column in param_file.txt contains trigger value (can be more than 1 column)

+ #info_file /whateverthepath/info_file.txt % output file for number of valid trials per input file

+ #mag_thresholds 2500 0 1500 0 % tresholds for artefact rejection, magnetometers (fT)

+ #grad_thresholds 1000 0 800 0 % tresholds for artefact rejection, gradiometers (fT/cm)

+ #eog_channels 307 308 % channel number of EOG channels

+ #thresholds 150 0 100 0 % tresholds for artefact rejection, EOG (uV)

+ #baseline -100 0 % interval for baseline correction with respect to trigger onset

+ #epoch_length 500 % length of epoch to be analysed

+ #pre_stim_time -100 % start latency of epoch (can be different from baseline)

%

% The following commands are specified for individual input files:

#fif /whateverthepath/MEG_infile.fif % input fiff-file

+ #outfif /whateverthepath/MEG_outfile.fif % base for output fiff-file (there will be different files for different regressors)

+ #fiff_template /whateverthepath/MEG_template.fif % if specified, sensor information from this file will be used for output

%

% Add more files in the same way:

#fif /whateverthepath/MEG_infile2.fif % input fiff-file

+ #outfif /whateverthepath/MEG_outfile2.fif % base for output fiff-file (there will be different files for different regressors)

+ #fiff_template /whateverthepath/MEG_template2.fif % if specified, sensor information from this file will be used for output

%

% If you want to assign new values to the triggers in the fiff-file, add "#event_list":

#fif /whateverthepath/MEG_infile3.fif % input fiff-file

+ #outfif /whateverthepath/MEG_outfile3.fif % base for output fiff-file (there will be different files for different regressors)

+ #fiff_template /whateverthepath/MEG_template3.fif % will be used for head coordinates

+ #event_list /whateverthepath/events3.txt 1 % The "1" indicates the column(s) in events3.txt that contain(s) the new trigger values. The file must contain as many values as there are triggers in the fiff-file. It will only produce a warning if this is not the case (see the log-file info_file.info_log), so be aware!


Note that anything following a "%" will be ignored (e.g. comments), anything following "#" is a command, and "+" signifies that this command still belongs to the same file. Once you are happy with your script and you have mentally prepared for it, run the script using EEG_correlation('regress_it.cof')in the Matlab command window.

It probably won't work, most likely because you've forgotten to add the following paths in the Matlab command window:

addpath /imaging/olaf/MEG/cam_tools /imaging/olaf/MEG/cam_tools/MEG /imaging/olaf/MEG/analysis

(a mistake easy to do, because I haven't told you to add them yet).

(and yes, sorry, it's not on Subversion yet)


  • So far, these programs have been applied to EEG data in visual word recognition experiments:
  • Hauk, O., Davis, M. H., Ford, M., Pulvermüller, F., & Marslen-Wilson, W. D. (2006). The time course of visual word recognition as revealed by linear regression analysis of ERP data. Neuroimage, 30(4), 1383-1400.

  • Hauk, O., Pulvermüller, F., Ford, M., Marslen-Wilson, W. D., & Davis, M. H. (2008). Can I have a quick word? Early electrophysiological manifestations of psycholinguistic processes revealed by event-related regression analysis of the EEG. Biol Psychol.

More on linear regression can be found in standard text books, such as:

  • Montgomery, D. C., Peck, E. A., & Vining, G. G. (2006). Introduction to Linear Regression Analysis. Hoboken, New Jersey: Wiley.

CbuMeg: LinearRegression (last edited 2013-03-08 10:02:16 by localhost)