[FieldTrip] cfgs for paired t-test and monte carlo testing

Rojas, Don Don.Rojas at ucdenver.edu
Thu Oct 27 19:58:54 CEST 2011


Julian,

Others can correct me if I'm wrong, but yes, I think you only need 1 row for a paired t-test in your design using the ttest2 function. So, if you have 2 conditions and 16 subjects, then your design specification is fine. For the same type of analysis, using method= 'montecarlo', your design should be something like:

[1:16 1:16; ones(1,16) ones(1,16)*2]

You'd need to specify ivar = 2 (i.e., row 1 in your design) and uvar = 1 for that design and a cfg.statistic = 'depsamplesT'. Wvar and Cvar don't need to be specified.

Best,

Don
-----------------------
Don Rojas, Ph.D.
Associate Professor of Psychiatry
U. of Colorado Denver Anschutz Medical Campus
Director, UCD Magnetoencephalography Lab
13001 E. 17th Pl F546
Aurora, CO 80045 USA


On Oct 27, 2011, at 8:34 AM, Julian Wang wrote:

Hi all,

I’m trying to run a paired t-test on a set of data that have been converted from SPM format using the function fttimelock, but I’m not sure if I’ve got the settings correct for it. The data consists of 16 subjects in a within-subject design with 2 conditions, from the help manual, I assumed that cfg.design should be:
[ones(1,16),ones(1,16)*2; 1:16, 1:16]

With the rest of the code being:
cfg.method = 'stats';
cfg.alpha     = 0.05;
cfg.tail      = 0;
cfg.feedback  = 'gui';
cfg.statistic = 'ttest2';
cfg.ivar = 1;
cfg.uvar = 2;

stats = ft_timelockstatistics(cfg,Subjects(1).timelockIllusory, Subjects(2).timelockIllusory,...
    Subjects(3).timelockIllusory, Subjects(4).timelockIllusory,...
    Subjects(5).timelockIllusory, Subjects(6).timelockIllusory,...
    Subjects(7).timelockIllusory, Subjects(8).timelockIllusory,...
    Subjects(9).timelockIllusory, Subjects(10).timelockIllusory,...
    Subjects(11).timelockIllusory, Subjects(12).timelockIllusory,...
    Subjects(13).timelockIllusory, Subjects(14).timelockIllusory,...
    Subjects(15).timelockIllusory, Subjects(16).timelockIllusory,...
    Subjects(1).timelockControl, Subjects(2).timelockControl,...
    Subjects(3).timelockControl, Subjects(4).timelockControl,...
    Subjects(5).timelockControl, Subjects(6).timelockControl,...
    Subjects(7).timelockControl, Subjects(8).timelockControl,...
    Subjects(9).timelockControl, Subjects(10).timelockControl,...
    Subjects(11).timelockControl, Subjects(12).timelockControl,...
    Subjects(13).timelockControl, Subjects(14).timelockControl,...
    Subjects(15).timelockControl, Subjects(16).timelockControl);


But if I run it, it comes up with an error saying that it’s only expecting one row in the design matrix. If it’s run with the design matrix just being [ones(1,16),ones(1,16)*2]
Then it runs fine and the result does look correct, but I’m not sure if it is. Is what I’ve done a paired t-test? Or is it running an unpaired t-test?

Also when running it through using the monte carlo method, I’m uncertain as to what values cfg.ivar, cfg.uvar, cfg.wvar and cfg.cvar should be, at the moment I’m using:
cfg.method = 'montecarlo';
cfg.design = [ones(1,16),ones(1,16)*2];
cfg.alpha     = 0.05;
cfg.tail      = 0;
cfg.feedback  = 'gui';
cfg.statistic = 'depsamplesT';
cfg.ivar = 1;
cfg.uvar = 2;
cfg.wvar = 2;
cfg.numrandomization = 'all';


but it keeps coming up with the following error:
??? Index exceeds matrix dimensions.

Error in ==> resampledesign at 103
  blkmeas = unique(design(cfg.wvar,:)', 'rows')';

Error in ==> statistics_montecarlo at 187
resample = resampledesign(cfg, design);

Error in ==> statistics_wrapper at 290
    [stat, cfg] = statmethod(cfg, dat, design, 'issource',issource);

Error in ==> ft_timelockstatistics at 124
[stat, cfg] = statistics_wrapper(cfg, varargin{:});

What am I doing wrong here?

Any help would be greatly appreciated.

Kind regards,

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20111027/9515e52a/attachment.html>


More information about the fieldtrip mailing list