<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Helvetica;color: #000000;font-size: 10pt;">
<div style="direction:ltr; font-family:Helvetica; color:#000000; font-size:10pt">
<div><span style="font-size: 10pt;">Hi Baptiste,</span></div>
<div>
<div><br>
</div>
<div>Indeed, as Jan points out, t-test and regression are all GLM.</div>
<div>You wonder what happened to the condition (cond 2) that you didn't use in the t-test:</div>
<div>In a regression with 3 conditions, the GLM 'contrasts' would be [-1 0 1] and [1 0 -1], so the 2nd condition is coded as ''0", meaning that without the 2nd condition the regression would also give exactly the same results...</div>
<div><br>
</div>
<div>Best,</div>
<div>Tineke</div>
<div><br>
</div>
<div>________________________________________</div>
<div>From: fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of jan@brogger.no [jan@brogger.no]</div>
<div>Sent: Wednesday, July 20, 2016 12:25 PM</div>
<div>To: fieldtrip@science.ru.nl</div>
<div>Subject: Re: [FieldTrip] Regression test and t-test providing almost    identical results</div>
<div><br>
</div>
<div>That is because a t- test and a regression test are the same. See this link: http://stats.stackexchange.com/questions/59047/how-are-regression-the-t-test-and-the-anova-all-versions-of-the-general-linear</div>
<div><br>
</div>
<div>Yours,</div>
<div><br>
</div>
<div>Jan Brogger</div>
<div><br>
</div>
<div>_______________________________________________</div>
<div>fieldtrip mailing list</div>
</div>
<div><br>
</div>
<div><br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF576887" style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of Baptiste Gauthier [gauthierb.ens@gmail.com]<br>
<b>Sent:</b> Wednesday, July 20, 2016 11:49 AM<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> [FieldTrip] Regression test and t-test providing almost identical results<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<p class="MsoNormal"><span lang="EN-US">Dear Fieldtrippers,</span></p>
<p class="MsoNormal"><span lang="EN-US">I recently observed a strange behavior with the results provided with the regression statistics provided by “</span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">ft_statfun_depsamplesregrT”:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">I did a regression test on 3 conditions: cond1, cond2 and cond3:</span></p>
<p class="MsoNormal"><span lang="EN-US">Here are the results:</span></p>
<p class="MsoNormal"><span lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span lang="EN-US"><img src="cid:ii_15607b35d29e022e" alt="Images intégrées 1" height="291" width="428"><br>
</span></p>
<p class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><b><span lang="EN-US">Output for group-level regression test:</span></b></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">the call to "ft_timelockgrandaverage" took 36 seconds and required the additional allocation of an estimated 0 MB</span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
<span style="">reading layout from file /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/From_laptop/fieldtrip-20130901/template/layout/NM306mag.lay</span><br>
<span style="">the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br>
<span style="">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br>
<span style="">using "ft_statistics_montecarlo" for the statistical testing</span><br>
<span style="">using "ft_statfun_depsamplesregrT" for the single-sample statistics</span><br>
<span style="">constructing randomized design</span><br>
<span style="">total number of measurements     = 57</span><br>
<span style="">total number of variables        = 2</span><br>
<span style="">number of independent variables  = 1</span><br>
<span style="">number of unit variables         = 1</span><br>
<span style="">number of within-cell variables  = 0</span><br>
<span style="">number of control variables      = 0</span><br>
<span style="">using a permutation resampling approach</span><br>
<span style="">repeated measurement in variable 1 over 19 levels</span><br>
<span style="">number of repeated measurements in each level is 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3<span class=""> </span></span><br>
<span style="">computing a parametric threshold for clustering</span><br>
<span style="">computing statistic</span><br>
<span style="">estimated time per randomization is 0.26 seconds</span><br>
<span style="">computing statistic 1000 from 1000</span><br>
<br>
<span style="">Warning: adding /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/fieldtrip-20160719/external/spm8 toolbox to your MATLAB path<span class=""> </span></span><br>
<span style="">found 13 positive clusters in observed data</span><br>
<span style="">found 9 negative clusters in observed data</span><br>
<span style="">computing clusters in randomization</span><br>
<span style="">computing clusters in randomization 1000 from 1000</span><br>
<br>
<span style="">using a cluster-based method for multiple comparison correction</span><br>
<span style="">the returned probabilities and the thresholded mask are corrected for multiple comparisons</span><br>
<span style="">the call to "ft_timelockstatistics" took 55 seconds and required the additional allocation of an estimated 12 MB</span></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">Afterwards, for some other reasons I performed directly a T-test between condition 1 and condition 3. Here is the result:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><img src="cid:ii_15607b394ad9a5b0" alt="Images intégrées 2" height="302" width="428"><br>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
</span></p>
<p class="MsoNormal" align="center" style="text-align:center"><span style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"></span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"></span></p>
<p class="MsoNormal"><b><span lang="EN-US">Output for group-level T-test:</span></b></p>
<p class="MsoNormal"><span class="im"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">the call to "ft_timelockgrandaverage" took 36 seconds and required the additional allocation of an estimated 0 MB</span></span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(80,0,80)"><br>
<span class="im">reading layout from file /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/From_laptop/fieldtrip-20130901/template/layout/NM306mag.lay</span><br>
<span class="im">the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br>
<span class="im">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br>
<span class="im">using "ft_statistics_montecarlo" for the statistical testing</span><br>
</span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"></span>using "ft_statfun_depsamplesT" for the single-sample statistics<span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
<span style="">constructing randomized design</span><br>
<span style="">total number of measurements     = 38</span></span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(80,0,80)"><br>
<span class="im">total number of variables        = 2</span><br>
<span class="im">number of independent variables  = 1</span><br>
<span class="im">number of unit variables         = 1</span><br>
<span class="im">number of within-cell variables  = 0</span><br>
<span class="im">number of control variables      = 0</span><br>
<span class="im">using a permutation resampling approach</span><br>
<span class="im">repeated measurement in variable 1 over 19 levels</span><br>
<span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(34,34,34)"></span>number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2<span class=""> </span></span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
</span><span class="im"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">computing a parametric threshold for clustering</span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
<span class="im">computing statistic</span><br>
</span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(34,34,34)"></span>estimated time per randomization is 0.04 seconds</span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(80,0,80)"><br>
<span class="im">computing statistic 1000 from 1000</span><br>
<br>
<span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(34,34,34)"></span>found 9 positive clusters in observed data</span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
<span style="">found 13 negative clusters in observed data</span></span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(80,0,80)"><br>
<span class="im">computing clusters in randomization</span><br>
<span class="im">computing clusters in randomization 1000 from 1000</span><br>
<br>
<span class="im">using a cluster-based method for multiple comparison correction</span><br>
<span class="im">the returned probabilities and the thresholded mask are corrected for multiple comparisons</span><br>
<span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(34,34,34)"></span>the call to "ft_timelockstatistics" took 46 seconds and required the additional allocation of an estimated 0 MB</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(80,0,80)"><br>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif; color:rgb(80,0,80)"><br>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">I checked that I actually provided the good data and parameters to the function, but I am puzzled by the resemblance (if you invert the sign) of
 the results. To doublecheck, I directly compared the stat.stat field from the two tests. Here are the results:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><img src="cid:ii_15607b3d4a7598ae" alt="Images intégrées 3" height="338" width="428"><br>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"><br>
</span></p>
<p class="MsoNormal"><span style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"></span><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">So basically, it is the same if you round to the 3<sup>rd</sup> digits after the floating point. It sounds really weird to me.
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">Has someone ever noticed something similar when performing regression tests? I there any simple mathematical tricks that could explain that?</span></p>
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">Best regards,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt; line-height:115%; font-family:Arial,sans-serif">Baptiste Gauthier, PhD</span></p>
<div><br>
</div>
-- <br>
<div class="gmail_signature">Baptiste Gauthier<br>
Postdoctoral Research Fellow<br>
<br>
INSERM-CEA Cognitive Neuroimaging unit<br>
CEA/SAC/DSV/DRM/Neurospin center<br>
Bât 145, Point Courier 156 <br>
F-91191 Gif-sur-Yvette Cedex FRANCE
<div style="display:inline"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>