# [FieldTrip] fieldtrip Digest, Vol 68, Issue 18

Maris, E.G.G. (Eric) e.maris at donders.ru.nl
Wed Jul 20 13:25:29 CEST 2016

```Hi Baptiste & Tineke,

Hi Baptiste,

Indeed, as Jan points out, t-test and regression are all GLM.
You wonder what happened to the condition (cond 2) that you didn't use in the t-test:
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...

Best,
Tineke

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].

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.

Btw, I may not reply to next post. I’m about to leave for vacation.

best,
Eric Maris

________________________________________
From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>] on behalf of jan at brogger.no<mailto:jan at brogger.no> [jan at brogger.no<mailto:jan at brogger.no>]
Sent: Wednesday, July 20, 2016 12:25 PM
To: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] Regression test and t-test providing almost    identical results

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

Yours,

Jan Brogger

_______________________________________________
fieldtrip mailing list

________________________________
From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>] on behalf of Baptiste Gauthier [gauthierb.ens at gmail.com<mailto:gauthierb.ens at gmail.com>]
Sent: Wednesday, July 20, 2016 11:49 AM
To: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
Subject: [FieldTrip] Regression test and t-test providing almost identical results

Dear Fieldtrippers,
I recently observed a strange behavior with the results provided with the regression statistics provided by “ft_statfun_depsamplesregrT”:
I did a regression test on 3 conditions: cond1, cond2 and cond3:
Here are the results:

<image.png>

Output for group-level regression test:
the call to "ft_timelockgrandaverage" took 36 seconds and required the additional allocation of an estimated 0 MB
reading layout from file /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/From_laptop/fieldtrip-20130901/template/layout/NM306mag.lay
the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB
the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 0 MB
using "ft_statistics_montecarlo" for the statistical testing
using "ft_statfun_depsamplesregrT" for the single-sample statistics
constructing randomized design
total number of measurements     = 57
total number of variables        = 2
number of independent variables  = 1
number of unit variables         = 1
number of within-cell variables  = 0
number of control variables      = 0
using a permutation resampling approach
repeated measurement in variable 1 over 19 levels
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
computing a parametric threshold for clustering
computing statistic
estimated time per randomization is 0.26 seconds
computing statistic 1000 from 1000

Warning: adding /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/fieldtrip-20160719/external/spm8 toolbox to your MATLAB path
found 13 positive clusters in observed data
found 9 negative clusters in observed data
computing clusters in randomization
computing clusters in randomization 1000 from 1000

using a cluster-based method for multiple comparison correction
the returned probabilities and the thresholded mask are corrected for multiple comparisons
the call to "ft_timelockstatistics" took 55 seconds and required the additional allocation of an estimated 12 MB

Afterwards, for some other reasons I performed directly a T-test between condition 1 and condition 3. Here is the result:

<image.png>

Output for group-level T-test:
the call to "ft_timelockgrandaverage" took 36 seconds and required the additional allocation of an estimated 0 MB
reading layout from file /neurospin/meg/meg_tmp/MTT_MEG_Baptiste/From_laptop/fieldtrip-20130901/template/layout/NM306mag.lay
the call to "ft_prepare_layout" took 0 seconds and required the additional allocation of an estimated 0 MB
the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 0 MB
using "ft_statistics_montecarlo" for the statistical testing
using "ft_statfun_depsamplesT" for the single-sample statistics
constructing randomized design
total number of measurements     = 38
total number of variables        = 2
number of independent variables  = 1
number of unit variables         = 1
number of within-cell variables  = 0
number of control variables      = 0
using a permutation resampling approach
repeated measurement in variable 1 over 19 levels
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
computing a parametric threshold for clustering
computing statistic
estimated time per randomization is 0.04 seconds
computing statistic 1000 from 1000

found 9 positive clusters in observed data
found 13 negative clusters in observed data
computing clusters in randomization
computing clusters in randomization 1000 from 1000

using a cluster-based method for multiple comparison correction
the returned probabilities and the thresholded mask are corrected for multiple comparisons
the call to "ft_timelockstatistics" took 46 seconds and required the additional allocation of an estimated 0 MB

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:

<image.png>

So basically, it is the same if you round to the 3rd digits after the floating point. It sounds really weird to me.
Has someone ever noticed something similar when performing regression tests? I there any simple mathematical tricks that could explain that?

Best regards,

Baptiste Gauthier, PhD

--
Baptiste Gauthier
Postdoctoral Research Fellow

INSERM-CEA Cognitive Neuroimaging unit
CEA/SAC/DSV/DRM/Neurospin center
Bât 145, Point Courier 156
F-91191 Gif-sur-Yvette Cedex FRANCE

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160720/c47af115/attachment-0001.html>
```