<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Baptiste & Tineke,
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">
<div style="font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; direction: ltr; font-size: 10pt;" class="">
<div style="direction: ltr; font-family: Helvetica; font-size: 10pt;" class="">
<div class=""><span style="font-size: 10pt;" class="">Hi Baptiste,</span></div>
<div class="">
<div class=""><br class="">
</div>
<div class="">Indeed, as Jan points out, t-test and regression are all GLM.</div>
<div class="">You wonder what happened to the condition (cond 2) that you didn't use in the t-test:</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Tineke</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>Is there a typo here, Tineke? The two contrast that you list are actually one and the same. There are multiple ways to specify the contrasts, and this is one way: [-1 1 0] and [0 -1 1].</div>
<div><br class="">
</div>
<div>Baptiste, what is your independent variable? This should be a quantitative variable (e.g., memory load) that varies over the three within-subjects conditions. Could you show your cfg.design? This would allow others to help you better.</div>
<div><br class="">
</div>
<div>Btw, I may not reply to next post. I’m about to leave for vacation.</div>
<div><br class="">
</div>
<div>best,</div>
<div>Eric Maris</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div style="font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; direction: ltr; font-size: 10pt;" class="">
<div style="direction: ltr; font-family: Helvetica; font-size: 10pt;" class="">
<div class="">
<div class="">________________________________________</div>
<div class="">From:<span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl" class="">fieldtrip-bounces@science.ru.nl</a><span class="Apple-converted-space"> </span>[<a href="mailto:fieldtrip-bounces@science.ru.nl" class="">fieldtrip-bounces@science.ru.nl</a>]
 on behalf of<span class="Apple-converted-space"> </span><a href="mailto:jan@brogger.no" class="">jan@brogger.no</a><span class="Apple-converted-space"> </span>[<a href="mailto:jan@brogger.no" class="">jan@brogger.no</a>]</div>
<div class="">Sent: Wednesday, July 20, 2016 12:25 PM</div>
<div class="">To:<span class="Apple-converted-space"> </span><a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a></div>
<div class="">Subject: Re: [FieldTrip] Regression test and t-test providing almost    identical results</div>
<div class=""><br class="">
</div>
<div class="">That is because a t- test and a regression test are the same. See this link:<span class="Apple-converted-space"> </span><a href="http://stats.stackexchange.com/questions/59047/how-are-regression-the-t-test-and-the-anova-all-versions-of-the-general-linear" class="">http://stats.stackexchange.com/questions/59047/how-are-regression-the-t-test-and-the-anova-all-versions-of-the-general-linear</a></div>
<div class=""><br class="">
</div>
<div class="">Yours,</div>
<div class=""><br class="">
</div>
<div class="">Jan Brogger</div>
<div class=""><br class="">
</div>
<div class="">_______________________________________________</div>
<div class="">fieldtrip mailing list</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div style="font-family: 'Times New Roman'; font-size: 16px;" class="">
<hr tabindex="-1" class="">
<div id="divRpF576887" style="direction: ltr;" class=""><font face="Tahoma" size="2" class=""><b class="">From:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl" class="">fieldtrip-bounces@science.ru.nl</a><span class="Apple-converted-space"> </span>[<a href="mailto:fieldtrip-bounces@science.ru.nl" class="">fieldtrip-bounces@science.ru.nl</a>]
 on behalf of Baptiste Gauthier [<a href="mailto:gauthierb.ens@gmail.com" class="">gauthierb.ens@gmail.com</a>]<br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Wednesday, July 20, 2016 11:49 AM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a><br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>[FieldTrip] Regression test and t-test providing almost identical results<br class="">
</font><br class="">
</div>
<div class=""></div>
<div class="">
<div dir="ltr" class="">
<p class="MsoNormal"><span lang="EN-US" class="">Dear Fieldtrippers,</span></p>
<p class="MsoNormal"><span lang="EN-US" class="">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: 14.566667556762695px; font-family: Arial, sans-serif;" class="">ft_statfun_depsamplesregrT”:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">I did a regression test on 3 conditions: cond1, cond2 and cond3:</span></p>
<p class="MsoNormal"><span lang="EN-US" class="">Here are the results:</span></p>
<p class="MsoNormal"><span lang="EN-US" class=""><br class="">
</span></p>
<p class="MsoNormal"><span lang="EN-US" class=""><span id="cid:ii_15607b35d29e022e"><image.png></span><br class="">
</span></p>
<div style="text-align: center;" class=""><span lang="EN-US" class=""></span><br class="webkit-block-placeholder">
</div>
<div class=""><span lang="EN-US" class=""> </span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><b class=""><span lang="EN-US" class="">Output for group-level regression test:</span></b></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">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: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
<span class="">reading layout from file /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/From_laptop/fieldtrip-20130901/template/layout/NM306mag.lay</span><br class="">
<span class="">the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br class="">
<span class="">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br class="">
<span class="">using "ft_statistics_montecarlo" for the statistical testing</span><br class="">
<span class="">using "ft_statfun_depsamplesregrT" for the single-sample statistics</span><br class="">
<span class="">constructing randomized design</span><br class="">
<span class="">total number of measurements     = 57</span><br class="">
<span class="">total number of variables        = 2</span><br class="">
<span class="">number of independent variables  = 1</span><br class="">
<span class="">number of unit variables         = 1</span><br class="">
<span class="">number of within-cell variables  = 0</span><br class="">
<span class="">number of control variables      = 0</span><br class="">
<span class="">using a permutation resampling approach</span><br class="">
<span class="">repeated measurement in variable 1 over 19 levels</span><br class="">
<span class="">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 class="">
<span class="">computing a parametric threshold for clustering</span><br class="">
<span class="">computing statistic</span><br class="">
<span class="">estimated time per randomization is 0.26 seconds</span><br class="">
<span class="">computing statistic 1000 from 1000</span><br class="">
<br class="">
<span class="">Warning: adding /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/fieldtrip-20160719/external/spm8 toolbox to your MATLAB path<span class=""> </span></span><br class="">
<span class="">found 13 positive clusters in observed data</span><br class="">
<span class="">found 9 negative clusters in observed data</span><br class="">
<span class="">computing clusters in randomization</span><br class="">
<span class="">computing clusters in randomization 1000 from 1000</span><br class="">
<br class="">
<span class="">using a cluster-based method for multiple comparison correction</span><br class="">
<span class="">the returned probabilities and the thresholded mask are corrected for multiple comparisons</span><br class="">
<span class="">the call to "ft_timelockstatistics" took 55 seconds and required the additional allocation of an estimated 12 MB</span></span></p>
<div class=""><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""> </span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">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: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><span id="cid:ii_15607b394ad9a5b0"><image.png></span><br class="">
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
</span></p>
<div style="text-align: center;" class=""><span style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""></span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><b class=""><span lang="EN-US" class="">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: 14.566667556762695px; font-family: Arial, sans-serif;" class="">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: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(80, 0, 80);" class=""><br class="">
<span class="im">reading layout from file /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/From_laptop/fieldtrip-20130901/template/layout/NM306mag.lay</span><br class="">
<span class="im">the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br class="">
<span class="im">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 0 MB</span><br class="">
<span class="im">using "ft_statistics_montecarlo" for the statistical testing</span><br class="">
</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""></span>using "ft_statfun_depsamplesT" for the single-sample statistics<span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
<span class="">constructing randomized design</span><br class="">
<span class="">total number of measurements     = 38</span></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(80, 0, 80);" class=""><br class="">
<span class="im">total number of variables        = 2</span><br class="">
<span class="im">number of independent variables  = 1</span><br class="">
<span class="im">number of unit variables         = 1</span><br class="">
<span class="im">number of within-cell variables  = 0</span><br class="">
<span class="im">number of control variables      = 0</span><br class="">
<span class="im">using a permutation resampling approach</span><br class="">
<span class="im">repeated measurement in variable 1 over 19 levels</span><br class="">
<span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(34, 34, 34);" class=""></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: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
</span><span class="im"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">computing a parametric threshold for clustering</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
<span class="im">computing statistic</span><br class="">
</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(34, 34, 34);" class=""></span>estimated time per randomization is 0.04 seconds</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(80, 0, 80);" class=""><br class="">
<span class="im">computing statistic 1000 from 1000</span><br class="">
<br class="">
<span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(34, 34, 34);" class=""></span>found 9 positive clusters in observed data</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
<span class="">found 13 negative clusters in observed data</span></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(80, 0, 80);" class=""><br class="">
<span class="im">computing clusters in randomization</span><br class="">
<span class="im">computing clusters in randomization 1000 from 1000</span><br class="">
<br class="">
<span class="im">using a cluster-based method for multiple comparison correction</span><br class="">
<span class="im">the returned probabilities and the thresholded mask are corrected for multiple comparisons</span><br class="">
<span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(34, 34, 34);" class=""></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: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(80, 0, 80);" class=""><br class="">
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif; color: rgb(80, 0, 80);" class=""><br class="">
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">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: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><span id="cid:ii_15607b3d4a7598ae"><image.png></span><br class="">
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""><br class="">
</span></p>
<div class=""><span style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""></span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">So basically, it is the same if you round to the 3<sup class="">rd</sup><span class="Apple-converted-space"> </span>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: 14.566667556762695px; font-family: Arial, sans-serif;" class="">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 class="">
</p>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">Best regards,</span></p>
<div class=""><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class=""> </span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size: 9.5pt; line-height: 14.566667556762695px; font-family: Arial, sans-serif;" class="">Baptiste Gauthier, PhD</span></p>
<div class=""><br class="">
</div>
--<span class="Apple-converted-space"> </span><br class="">
<div class="gmail_signature">Baptiste Gauthier<br class="">
Postdoctoral Research Fellow<br class="">
<br class="">
INSERM-CEA Cognitive Neuroimaging unit<br class="">
CEA/SAC/DSV/DRM/Neurospin center<br class="">
Bât 145, Point Courier 156<span class="Apple-converted-space"> </span><br class="">
F-91191 Gif-sur-Yvette Cedex FRANCE
<div style="display: inline;" class=""></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="mailto:fieldtrip@donders.ru.nl" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">fieldtrip@donders.ru.nl</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>