How does one do simulations for statistics?

Stanley Klein sklein at BERKELEY.EDU
Tue Nov 24 11:18:23 CET 2009

I too have lots of questions on how to do statistics on EEG and MEG.
Right now for example we are getting very similar EEG and MEG
waveforms (following SVD) and are trying out various statistical ways
of comparing them. In addition to using Fieldtrip's wonderful (but
complicated) cluster permutation test for dealing with multiple
comparisons and correlated noise issues we are trying other ideas. The
only way that we can figure out whether we are on the right track is
to do simulations where we know the correct answer. Does anyone have
good advice on how to do good simulations? We are using the CTF
machine for our EEG and MEG (and Biosemi for EEG alone). Every sample
is about 2 msec. For a single trace  we are using something like the
following Matlab code that gives a flat amplitude spectrum out to 15
Hz and then close to 1/f^2 beyond that.

x(1:2)=[0 1];
for i=3:10000;
   x(i) = 1.81*x(i-1) -.85*x(i-2)+randn;  %AR model for time series

The AR coefficients were obtained by trial and error and have a lot of

The question again is whether anyone has good suggestions for how to
simulate EEG or MEG noise in the time domain?  Even better would be
something good to read.   I'd like the noise to be manufactured in the
time domain since I'll be doing other things for the signal in the
time domain including multiplicative noise. Without good simulations
how do people test all their statistics, especially when there is a
bunch of preprocessing like SVD (or complicated, nonlinear interaction
Stan Klein

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. See also and

More information about the fieldtrip mailing list