[FieldTrip] Problems with Parametric T-test Statistics of a single subject

Resfita.Nova at mh-hannover.de Resfita.Nova at mh-hannover.de
Thu Aug 31 15:06:19 CEST 2023

Dear FieldTrip Community,

My name is Nova and I am new to FieldTrip. I am currently working on the parametric statistics of the ERP data (obtained from 32 electrodes) but I face some problems. I have tried googling and reading the tutorials and posts on mailing lists, but I still can't solve the problems. Could you please assist me in finding the solutions?

Here are the problems:

I would like to perform the parametric statistics on the ERP data, I have 2 sets of data called dataresponse and databaseline (each has 270 trials, with dimensions 270x32x584 double). I calculated the ERPs of each dataset by averaging the signals over the number of trials. I would like to compare both data of one subject on the channel level. On the tutorial website, it was on the group level. I tried to adjust my codes for the cfg.design, but I still can't find the solutions.

In order to calculate the statistics on channel electrode 10, I used the ttest2 function on MATLAB with this script:
[h,p] = ttest2(avgdataresponse.avg(10,:), avgdatabaseline.avg(10,:),'alpha',0.05);

%avgdataresponse and avgdatabaseline are the average over trials,

then I obtained the h=1, p= 1.323e-04.

However, when I tried with Fieldtrip function, I obtained different numbers.

1) When using the "ft_statfun_indepsamplesT" function with this script, I obtained NaN for stat, critval, and prob. Does it have to do with the cfg.design? What is the correct cfg.design for the parametric T-test on a channel level for a single subject?
cfg = [];
cfg.channel     = 'Audio10';
cfg.latency     = [0.017 0.6];
cfg.avgovertime = 'yes';
cfg.parameter   = 'avg';
cfg.method      = 'analytic';
cfg.statistic   = 'ft_statfun_indepsamplesT';
cfg.alpha       = 0.05;
cfg.correctm    = 'no';

n_dataresponse = size(dataresponse.trial, 1); %number of trials in data response (since the number of trials is the same as that of databaseline, I use one of them)

cfg.design(1,1:2*n_dataresponse) = [ones(1,n_databaseline), ones(1,n_dataresponse)*2];
cfg.design(2,1:2*n_dataresponse) = [1:n_dataresponse 1:n_dataresponse];
cfg.ivar             = 1;

stat = ft_timelockstatistics(cfg, avgdataresponse, avgdatabaseline);

2. When I change the parameter: cfg.parameter   = 'trial' and stat = ft_timelockstatistics(cfg, dataresponse, databaseline);
I obtained the p-value = 0.040. Is this p-value correct? or is it still wrong because of my cfg.design?

3. I tried also with "ft_statfun_depsamplesT" with the same configuration as no.1 and added the cfg.uvar =2, I obtained errors:

Error using ft_statfun_depsamplesT (line 78)
Invalid specification of the design array.

Error in ft_statistics_analytic (line 94)
  [stat, cfg] = statfun(cfg, dat, design);

Error in ft_timelockstatistics (line 185)
  [stat, cfg] = statmethod(cfg, dat, design);

Is there a significant design array for a particular parametric T-test? What is the specification of the design array for independent and dependent T-test? (I tried searching about it but I couldn't find the answers.)

4. When I still use "ft_statfun_depsamplesT" but changing cfg.parameter = 'trial' and stat = ft_timelockstatistics(cfg, dataresponse, databaseline); I acquired the p value = 0.0989.

Why is the p-value still different than the one obtained from the ttest2 function? What should I change in order to obtain a similar value as what is acquired on the ttest2 Matlab function? Based on the tutorial, the p-value should be the same.

I would really appreciate any help and advice on these problems.

Thank you very much and have a great day.

Best regards,

Nova Resfita

Nova Resfita, M.Sc.

PhD student

Medizinische Hochschule Hannover
Institut für AudioNeuroTechnologie (VIANNA)
OE 8891, M20, Ebene 01, Raum 2220
Stadtfelddamm 34
30625 Hannover

Tel.: +49 511 532-7270
Email: Resfita.Nova at mh-hannover.de<mailto:Sollmann.Lea at mh-hannover.de>
Web: <https://urldefense.com/v3/__http://www.neuroprostheses.com/__;!!HJOPV4FYYWzcc1jazlU!6NmIRxmwMH2BGQeJpQjL_UdFTljNLDILpnfphX9NMxnYsEwmHbU4FgErbLsshcSwuH4GBACoOhorFap0BMLtlrKc0IF8auc4Tw$ > https://urldefense.com/v3/__http://www.neuroprostheses.com__;!!HJOPV4FYYWzcc1jazlU!6NmIRxmwMH2BGQeJpQjL_UdFTljNLDILpnfphX9NMxnYsEwmHbU4FgErbLsshcSwuH4GBACoOhorFap0BMLtlrKc0IH0WCzu8Q$ <https://urldefense.com/v3/__https://www.neuroprostheses.com/AK/Main.html__;!!HJOPV4FYYWzcc1jazlU!6NmIRxmwMH2BGQeJpQjL_UdFTljNLDILpnfphX9NMxnYsEwmHbU4FgErbLsshcSwuH4GBACoOhorFap0BMLtlrKc0IHCWoKhaQ$ >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230831/09b306cf/attachment.htm>

More information about the fieldtrip mailing list