# depsamplesF

Eric Maris e.maris at DONDERS.RU.NL
Wed Sep 9 11:56:47 CEST 2009

```Dear Stephan,

> Having recently used depsamplesF I had a look at the code as Nadia had
some
> doubts. In the newer edition (1998) of the Johnson and Wichern book I
guess
> the line 136:
s.stat(smplindx)=nunits*contrastavg*inv(covmat)*contrastavg';
> corresponds to formula 5-4 at page 226.
> n(X-u)' S(-1) (X-u)

(I don't have the 1998 edition.) I guess the u in the formula above is the
vector of expected values of the contrasts under the null hypothesis (almost
always set equal to zeros, as is also the case in the depsamplesF statfun).

>
> line 151: s.critval =
((nunits-1).*ncontrasts./(nunits-ncontrasts)).*finv(1-
> cfg.alpha,s.dfnum,s.dfdenom); corresponds to formula 5-6 (grey box) at
page
> 226.
> P[T^2 > (n-1)/(n-p) F(p,n-p)]

I think this must be ((n-1)*p)/(n-p) F(p,n-p).

If you want to check the output of depsamplesF, you could look at one row of
the matrix dat. Every row corresponds to a particular channel,
channel-by-time pair, channel-by-frequency pair,
channel-by-frequency-by-time triplet, etc. The output of depsamplesF for one
such row should be identical to the T^2-statistic that is calculated using
some other statistics package. (Note that a row of the matrix dat
corresponds to the usual nsubjects-by-nconditions matrix. However, in dat,
this matrix is reshaped as a row vector.)

>
> Please let me know if I got that right for adquate reporting of the
method.
>
> Many thanks,
>
> Stephan
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users of the
FieldTrip
> toolbox, to share experiences and to discuss new ideas for MEG and EEG
analysis.