[FieldTrip] cfgs for paired t-test and monte carlo testing
Julian Wang
julian.wang at ucl.ac.uk
Sun Nov 6 18:52:32 CET 2011
Dear Don,
Thanks very much for your reply, your solution worked perfectly. I was
wondering if you could help me on another problem I'm having. I'm trying to
now run a multiple comparison corrected monte carlo test on the same
dataset, using the following settings and with your design matrix:
cfg.method = 'triangulation';
cfg.layout = 'C:\Program
Files\MATLAB\R2011a\toolbox\fieldtrip\template\layout\biosemi64.lay';
neighbours = ft_prepare_neighbours(cfg);
cfg.channel = 'EEG';
cfg.latency = [0 0.8];
cfg.avgoverchan = 'no';
cfg.avgovertime = 'no';
cfg.parameter = 'individual';
cfg.method = 'montecarlo';
cfg.statistic = 'depsamplesT';
cfg.alpha = 0.05;
cfg.clusteralpha = 0.05;
cfg.feedback = 'gui';
cfg.numrandomization = '1000';
cfg.correctm = 'cluster';
cfg.correcttail = 'prob';
cfg.minnbchan = 2;
cfg.neighbours = neighbours;
cfg.clusterstatistic = 'maxsum';
but it's coming up with this error and I'm not sure why
Error in ==> fieldtrip\private\resampledesign at 69
ft_checkopt(cfg, 'ivar', {'numericscalar', 'numericvector', 'empty'});
??? Output argument "resample" (and maybe others) not assigned during call
to "C:\Program
Files\MATLAB\R2011a\toolbox\fieldtrip\private\resampledesign.m>resampledesig
n".
Error in ==> statistics_montecarlo at 193
resample = resampledesign(cfg, design);
Error in ==> statistics_wrapper at 290
[stat, cfg] = statmethod(cfg, dat, design, 'issource',issource);
Error in ==> ft_timelockstatistics at 128
[stat, cfg] = statistics_wrapper(cfg, varargin{:});
At first I thought it might have something to do with design matrix, so I
went through the help manual for cluster based permutation tests on event
related fields and copied their design matrix (below), but it still comes up
with the same error.
Nsub = 16;
cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)];
cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub];
cfg.ivar = 1;
cfg.uvar = 2;
Again, any help would be greatly appreciated.
Kind regards,
Julian
From: fieldtrip-bounces at donders.ru.nl
[mailto:fieldtrip-bounces at donders.ru.nl] On Behalf Of Rojas, Don
Sent: 27 October 2011 06:59 PM
To: Email discussion list for the FieldTrip project
Subject: Re: [FieldTrip] cfgs for paired t-test and monte carlo testing
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
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20111106/70f04226/attachment-0001.html>
More information about the fieldtrip
mailing list