<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>LinearRegression</title><revhistory><revision><revnumber>42</revnumber><date>2013-03-08 10:02:16</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>41</revnumber><date>2009-04-06 13:52:30</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>40</revnumber><date>2009-04-03 17:27:32</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>39</revnumber><date>2009-04-03 17:27:10</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>38</revnumber><date>2009-04-03 17:26:28</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>37</revnumber><date>2009-04-03 17:25:21</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>36</revnumber><date>2009-04-03 17:16:52</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>35</revnumber><date>2009-04-03 17:16:33</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>34</revnumber><date>2009-04-03 17:16:12</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>33</revnumber><date>2009-04-03 17:15:50</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>32</revnumber><date>2009-04-03 16:46:48</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>31</revnumber><date>2009-04-03 16:46:27</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>30</revnumber><date>2009-04-03 16:46:04</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>29</revnumber><date>2009-04-03 16:45:27</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>28</revnumber><date>2009-04-03 16:41:42</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>27</revnumber><date>2009-02-17 11:49:30</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>26</revnumber><date>2009-02-17 11:26:51</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>25</revnumber><date>2009-02-16 15:17:42</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>24</revnumber><date>2009-02-16 15:16:53</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>23</revnumber><date>2009-02-16 15:15:06</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>22</revnumber><date>2009-02-16 15:08:39</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>21</revnumber><date>2009-02-16 15:08:08</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>20</revnumber><date>2009-02-16 15:00:46</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>19</revnumber><date>2009-02-16 14:58:56</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>18</revnumber><date>2009-02-16 14:58:46</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>17</revnumber><date>2009-02-12 12:55:57</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>16</revnumber><date>2009-02-12 12:55:16</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>15</revnumber><date>2009-02-12 12:54:24</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>14</revnumber><date>2009-02-12 12:52:24</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>13</revnumber><date>2009-02-12 12:51:54</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>12</revnumber><date>2009-02-12 10:35:52</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>11</revnumber><date>2009-02-12 10:35:18</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>10</revnumber><date>2009-02-12 10:34:48</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>9</revnumber><date>2009-02-12 10:33:24</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>8</revnumber><date>2009-02-12 10:32:38</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>7</revnumber><date>2009-02-12 10:31:39</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>6</revnumber><date>2009-02-12 10:26:44</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>5</revnumber><date>2009-02-12 10:21:06</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>4</revnumber><date>2009-01-12 14:30:43</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>3</revnumber><date>2009-01-12 14:28:09</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>2</revnumber><date>2009-01-12 14:27:12</date><authorinitials>YaaraErez</authorinitials></revision><revision><revnumber>1</revnumber><date>2009-01-12 14:06:02</date><authorinitials>YaaraErez</authorinitials></revision></revhistory></articleinfo><para><emphasis role="strong">Multiple regression analysis applied to EEG and MEG data</emphasis> </para><para>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 <emphasis role="strong">b</emphasis> of the linear equation <emphasis role="strong">y</emphasis>=<emphasis role="strong">Xb</emphasis>,   where y are the data, <emphasis role="strong">X</emphasis> the &quot;design matrix&quot; including the predictor variables for all items (e.g. word length, familiarity, etc.), and <emphasis role="strong">b</emphasis> contains one regression coefficient per predictor variable. </para><para>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 <ulink url="mailto:olaf.hauk@mrc-cbu.cam.ac.uk">olaf.hauk@mrc-cbu.cam.ac.uk</ulink>. A different approach to regression analysis is also part of SPM5. </para><para>In order to run your analysis, you should use a <emphasis role="strong">text editor</emphasis> (e.g. Textpad, Wordpad etc.) to create a script like the following (why not call it &quot;<emphasis role="strong">regress_it.cof</emphasis>&quot; for now): </para><!--rule (<hr>) is not applicable to DocBook--><itemizedlist><listitem override="none"><para>% The parameters following ### are defined once for all input files: </para></listitem></itemizedlist><para><emphasis role="strong">### #correl_type combine</emphasis> </para><para><emphasis role="strong">+ #param_file /whateverthepath/param_file.txt</emphasis>                      % file that defines predictor variables for each trigger value </para><para><emphasis role="strong">+ #correl_columns 4 5 6 7 8 9                                 </emphasis>% specifies which columns in param_file contain the predictor variables </para><para><emphasis role="strong">+ #trigger_columns 2                                                </emphasis>% specifies which column in param_file.txt contains trigger value (can be more than 1 column) </para><para><emphasis role="strong">+ #info_file /whateverthepath/info_file.txt                               </emphasis>% output file for number of valid trials per input file </para><para><emphasis role="strong">+ #mag_thresholds 2500 0 1500 0</emphasis>                                        % thresholds for artefact rejection, magnetometers (fT) </para><para><emphasis role="strong">+ #grad_thresholds 1000 0 800 0</emphasis>                                           % thresholds for artefact rejection, gradiometers (fT/cm) </para><para><emphasis role="strong">+ #eog_channels 307 308</emphasis>                                                       % channel number of EOG channels </para><para><emphasis role="strong">+ #thresholds 150 0 100 0</emphasis>                                                       % thresholds for artefact rejection, EOG (uV) </para><para><emphasis role="strong">+ #baseline -100 0                                                                    </emphasis>% interval for baseline correction with respect to trigger onset </para><para><emphasis role="strong">+ #epoch_length 500</emphasis>                                                                % length of epoch to be analysed </para><para><emphasis role="strong">+ #pre_stim_time -100</emphasis>                                                             % start latency of epoch (can be different from baseline) </para><para>% </para><para>% The following commands are specified for individual input files: </para><para><emphasis role="strong">#fif /whateverthepath/MEG_infile.fif</emphasis>    % input fiff-file </para><para><emphasis role="strong">+ #outfif /whateverthepath/MEG_outfile.fif</emphasis>   % base for output fiff-file (there will be different files for different regressors) </para><para><emphasis role="strong">+ #fiff_template /whateverthepath/MEG_template.fif</emphasis>       % if specified, sensor information from this file will be used for output </para><para>% </para><para>% Add more files in the same way: </para><para><emphasis role="strong">#fif /whateverthepath/MEG_infile2.fif</emphasis>    % input fiff-file </para><para><emphasis role="strong">+ #outfif /whateverthepath/MEG_outfile2.fif</emphasis>   % base for output fiff-file (there will be different files for different regressors) </para><para><emphasis role="strong">+ #fiff_template /whateverthepath/MEG_template2.fif</emphasis> % if specified, sensor information from this file will be used for output </para><para>% </para><para>% If you want to assign new values to the triggers in the fiff-file, add &quot;#event_list&quot;: </para><para><emphasis role="strong">#fif /whateverthepath/MEG_infile3.fif</emphasis>    % input fiff-file </para><para><emphasis role="strong">+ #outfif /whateverthepath/MEG_outfile3.fif</emphasis>   % base for output fiff-file (there will be different files for different regressors) </para><para><emphasis role="strong">+ #fiff_template /whateverthepath/MEG_template3.fif</emphasis>       % will be used for head coordinates </para><para><emphasis role="strong">+ #event_list /whateverthepath/events3.txt 1</emphasis> % The &quot;1&quot; 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! </para><!--rule (<hr>) is not applicable to DocBook--><para> The file <emphasis role="strong">param_file.txt</emphasis> could for example look like this: </para><para>(first column is the name of the stimulus, 2nd/3rd are trigger values, and the rest are predictor variables) </para><para>apple.bmp 107 3 1.392900 -0.479850 0.417390 0.080390 1.092110 0.115550 625.0 </para><para>axe.bmp 145 5 -0.914140 1.043010 -1.223180 0.280600 1.395510 1.153300 740.0 </para><para>ball.bmp 122 6 1.721340 -0.171140 -1.435500 -1.734850 -1.500380 0.311110 712.0 </para><para>balloon.bmp 22 7 0.340310 0.050460 1.517780 -0.214130 1.548640 -1.440000 676.0 </para><para>banana.bmp 52 8 0.280850 0.032000 -0.283840 -0.220450 0.876610 -0.513280 584.0 </para><para>barrel.bmp 18 9 -0.966440 -0.128640 -1.260160 -0.348910 0.028620 -0.941300 588.0 </para><para>basket.bmp 94 10 -0.676920 0.809610 -0.015460 -1.146530 -1.728440 -1.320280 642.0 </para><para>bed.bmp 30 11 1.923550 0.518270 1.482960 -0.264860 0.419940 0.693060 500.0 </para><para>belt.bmp 46 13 0.317560 0.866460 -1.206650 -0.045100 0.528740 -0.779480 833.0 </para><para>bird.bmp 99 15 1.360470 -1.867280 0.344520 -0.981430 -1.532860 1.941360 898.0 </para><para>book.bmp 54 16 1.765150 1.272160 1.076190 0.161320 1.236470 -0.198840 546.0 </para><para>bottle.bmp 49 18 1.083290 1.188760 -0.516730 -0.057490 -0.923770 0.478310 590.0 </para><para>bow.bmp 108 19 0.500370 -0.256740 -0.935070 -2.023320 -2.340750 -1.261620 597.0 </para><para>... </para><!--rule (<hr>) is not applicable to DocBook--><para>Note that anything following a &quot;%&quot; will be ignored (e.g. comments), anything following &quot;#&quot; is a command, and &quot;+&quot; 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 </para><para><emphasis role="strong">EEG_correlation('regress_it.cof')</emphasis> </para><para>in the Matlab command window. </para><para>It probably won't work, most likely because you've forgotten to add the following paths in the Matlab command window: </para><para><emphasis role="strong">addpath /imaging/olaf/MEG/cam_tools /imaging/olaf/MEG/cam_tools/MEG /imaging/olaf/MEG/analysis</emphasis> </para><para>(a mistake easy to do, because I haven't told you to add them yet). </para><para>(and yes, sorry, it's not on Subversion yet) </para><!--rule (<hr>) is not applicable to DocBook--><itemizedlist><listitem override="none"><para>So far, these programs have been applied to EEG data in visual word recognition experiments: </para></listitem><listitem><para>Hauk, O., Davis, M. H., Ford, M., Pulvermüller, F., &amp; 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. </para></listitem><listitem><para>Hauk, O., Pulvermüller, F., Ford, M., Marslen-Wilson, W. D., &amp; 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. </para></listitem></itemizedlist><para>More on linear regression can be found in standard text books, such as: </para><itemizedlist><listitem><para>Montgomery, D. C., Peck, E. A., &amp; Vining, G. G. (2006). <emphasis>Introduction to Linear Regression Analysis</emphasis>. Hoboken, New Jersey: Wiley. </para></listitem></itemizedlist></article>