# Mixed design + permutation test

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Tue Mar 25 13:10:58 CET 2008

Hi Margriet,

The fieldtrip statistics functions (timelockstatistics,
freqstatistics and sourcestatistics) allow you to do this. You should
specify a design matrix (cfg.design) with one row for the condition
number (I suggest to use condition numbers "1", "2" and "3"), a
second row with the subject number and a third row for the two group
(1 and 2). Subsequently you can supply your own statistic to be
tested using the montecarlo permutation approach, by specifiying
cfg.method='montecarlo' and cfg.statistic='xxx'. This will cause a
function to be called with the name "statfun_xxx.m". This is a
function that you can easily implement yourself, including the
suggestions of Guillame. Example statfuns can be found in fieldtrip/
private. The statfun gets called for each permutation of the columns
of the design matrix. In your case, you want the permutations of the
columns to be restricted to within the groups. The resampling/
permuting of the design matrix is done by the function fieldtrip/
private/resampledesign. If I recall correctly (please look into that
function), you should specify cfg.ivar=1 (for the 3 levels of your
condition), cfg.uvar=2 (for the "unit of observation", i.e. subject)
and cfg.wvar=2 (for keeping the shuffles within each group).

Using the fieldtrip statistics functions with your own statfun allows
you to use the multiple comparison correction techniques already
implemented (including max-statistic, FDR and even clustering). In
case of an f-statistic, you should specify the other options
correctly so that the permulation distribution is tested only one-sided.

best regards,
Robert

On 19 Mar 2008, at 14:44, Margriet Groen wrote:
> Hi,
>
> please excuse my ignorance, but is it possible to use permutation
> tests with a mixed (3 conditions x 2 groups) design?
>
> Thanks,
> Margriet
>
> --
> =================================
> Dr. Margriet A. Groen
> Post-doctoral researcher
> University of Hamburg
> Biological Psychology and Neuropsychology
> Von-Melle-Park 11
> 20146 Hamburg
> Germany
>
> Phone: +49-40-42838-5838
> Fax: +49-40-42838-6591
> Email: margriet.groen at uni-hamburg.de
> Website: http://bpn.uni-hamburg.de/groen_e.html
> =================================
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users
> of the FieldTrip  toolbox, to share experiences and to discuss new