# [FieldTrip] design matrix for ft_freqstatistics; between subjects

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Fri Apr 26 22:08:36 CEST 2013

```Dear Ke,

A grandaverage is typically an average over subjects, not trials -
seems appropriate in the case you describe. Does it make sense then?

Have you taken a look at the end of [user documentation] -->
[walkthrough] on the wiki? In it I've made some effort  explaining the
cfg.design in the statistics functions. It might need more work so if
it is still unclear (or if it does help and you have a suggestion for
placing a link at an appropriate place in the tutorial) it would be
great to hear so I can work on making it clearer.

Cheers,
Stephen

On 26 April 2013 21:46, liao ke <kekeliao at gmail.com> wrote:
> Hi, Kathrin,
>
> I meet similar question on comparison of ERP between two group subjects
> using ft_timelockstatistics and  ft_timelockanalysis. One group has 12
> subjects, another group has 43 subjects, and my design matrix is like
>
> design = zeros(1, 55);
> design(1, 1:12) = 1;
> design(1, 12+1:end )= 2;
> cfg.design = design;             % design matrix
> cfg.ivar  = 1;
>
>
> After I invoke ft_timelockanalysis, I use ft_timelockgrandaverage to
> calculate grand average with cfg.keepindividual = 'yes' . Then the following
> ft_timelockstatistics  works well. If I use cfg.keepindividual = 'no' in
> ft_timelockgrandaverage , the ft_timelockstatistics has error 'the size of
> the design matrix does not match the number of observations in the data'  in
> its statistics_wrapper subfunction.
>
> My question is why I should keep all trials data (cfg.keepindividual =
> 'yes') in ft_timelockgrandaverage ? I guess the method in
> ft_timelockstatistics should use subjects averaged data as sample ( average
> over trials data of this subject ) not use all subjects trial-based data. Am
> I correct?
>
>
> ke
>
>
> On Sat, Dec 1, 2012 at 9:15 AM, Kathrin Müsch <k.muesch at uke.uni-hamburg.de>
> wrote:
>>
>>
>> It's like a between trials experiment within one subject (first example of
>> the tutorial). Your design is correct. Remember to use independent samples
>> statistics because you compare two independent groups (in your case
>> subjects).
>>
>> cfg.statistic = 'indepsamplesT';
>> cfg. design = design;
>> cfg.ivar = 1;
>>
>> Best,
>> Kathrin
>>
>> Am 01.12.2012 um 15:02 schrieb Nenad Polomac:
>>
>> > Hi everybody,
>> >
>> > I have some doubts concerning statistic in between subjects experiment.
>> > I couldn't find explanation for this case in tutorial.
>> > I have two groups of subjects. And I would like to compare this two
>> > groups for the same condition using ft_freqstatistics (cfg.correctm =
>> > 'cluster'). I have two time frequency grand average for each group (8
>> > subjects in each group; cfg.keepindividual = 'yes';). I am not sure how a
>> > design matrix for ft_freqstatistics suppose to look like
>> >
>> > I suppose: design=[1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2]
>> > Is this correct?
>> >
>> > Thank you in advance!
>> >
>> >
>> >
>> > _______________________________________________
>> > fieldtrip mailing list
>> > fieldtrip at donders.ru.nl
>> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> --
>> Pflichtangaben gemäß Gesetz über elektronische Handelsregister und
>> Genossenschaftsregister sowie das Unternehmensregister (EHUG):
>>
>> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
>> Rechts; Gerichtsstand: Hamburg
>>
>> Vorstandsmitglieder: Prof. Dr. Martin Zeitz (Vorsitzender), Dr. Alexander
>> Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

```